ULI101 Week 6

From CDOT Wiki
Revision as of 08:29, 31 August 2017 by Mark (talk | contribs) (Created page with "* Running Live Linux * Sending email from command line * scp and sftp utilities * Installing Linux * Linux on your Desktop * Virtualization * Basic Linux system administration...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • Running Live Linux
  • Sending email from command line
  • scp and sftp utilities
  • Installing Linux
  • Linux on your Desktop
  • Virtualization
  • Basic Linux system administration

What is Live Linux?

Most major Linux distributions offer a Live version, which allows users to run the OS without installing it. Most often, the Live OS is in a form of a CD or DVD, but it is possible to have Live USB Linux as well. Users can boot the OS without affecting the existing OS which can be very useful:

  • Troubleshooting
  • Hardware compatibility testing before install
  • Virus removal
  • Trying out a new/unknown distribution

Although any files created and changed during a live session are not saved after restart, you can save files on portable storage (such as a USB memory stick) or on the local hard drive after manual mount. You will be asked to use one such Live Linux: Knoppix during this week's lab. Instructions on how to do so will be given later.

mail

  • Send or receive electronic email
  • mail as a set of own commands, similar to ftp in concept
  • Some systems may have an updated version called mailx. Using mail will call mailx transparently.
  • Steps when sending email:

    • Type: mail recipient@hostname [press Enter]
    • Enter subject [press Enter]
    • Type the body of the message
    • Exit by pressing Ctrl+D simultaneously when finished typing message
  • Alternatively, you can use a previously composed message (in a file)

    mail recipient@hostname -s “Subject” < file

Copying Files Over Network

Linux command-line utility scp, copies files securely across a network. Files can be transferred between local and remote host as well as between two remote hosts. Transmission is encrypted using SSL.

Usage is similar to the cp command with the addition of host names, for example:

scp local.file user@host:/destination

The user name in the command can be omitted if it's the same username as on the local host. Multiple file and recursive directory copy is supported.

sftp

A secure version of the legacy ftp utility.

  • Usage: sftp user@host

=sftp= is similar to scp as both of them transfer files to and from local and remote computers. Like scp, the user name can be left out if the username name on the remote server is the same as the username on the local machine.

Provides some level of interaction with the remote file system - listing files, changing directories etc. Linux offers many GUI tools simplifying the process of transfering files from local to remote, one such graphical program is gFTP.

Unlike scp, however, sftp cannot connect between two remote hosts. When you are connected to a server the following terms apply:

Local Server
Your current machine.
Remote Server
Server that you are connected, or want to connect, to.
The term remote is loosely used because if your local machine is running Windows and you run Live Linux in a virtual machine, then the remote server from the Windows machine can be your Linux running in a VM.

Similarly, if your local machine has access to a USB storage device, you can transfer files for backup purposes from the server.

  • sftp commands to navigate throughout your remote server:
ls List files
pwd Display current directory
cd Change remote directory
  • sftp commands to navigate throughout your local server:
!ls List local files
!pwd Display current local directory
lcd Change local directory
  • sftp commands to transfer files between local and remote server:
# to tranfer some_remote_file from remote to local, do the following
$ sftp user@host
get some_remote_file
<CTRL+d>

# to tranfer some_local_file from local to remote, do the following
$ sftp user@host
put some_local_file
<CTRL+d>
* It is advised to set your local and remote directories before you transfer.
  • The commands mget and mput can be used to copy multiple files using wildcard characters like *

After transferring a file between servers, always verify that the transfer has been successfully completed (refer to commands to navigate throughout local and remote servers).

To exit the sftp shell, you can enter the commands:

  • bye
  • exit
  • Ctrl+d

Linux GUI and remote files

Linux GUI file managers such as Nautilus have the ability to access remote file-systems. Various protocols are supported, but the typical choice for remote Linux hosts is the SSH. You get the security of SSH with the convenience of the GUI interface.

Use the “File...Connect to Server...” menu choice. You can do this from the Live Linux disc or your own Linux system to access your files on Matrix.

Once connected, the remote file system will appear as a directory/folder for all GUI applications - this is how cloud storage is implemented

Installing Linux

  • Standalone installation
  • Linux is the only OS on the computer
  • Any existing data on disk will be erased
  • Multi-boot setup
  • A boot menu allows the user to select the desired OS
  • The installation process will take some of the free disk space from OS already installed
  • Back up important data before proceeding
  • Install Linux last, as other operating systems may not offer a multi-boot option
  • Virtualized installation

Where to install Linux?

  • Desktop
  • Personal use or corporate use
  • Open Source community member
  • Very good products
  • GPL: Free
  • Server
  • Very popular as part of LAMP stack
  • Linux, Apache, MySQL, PHP
  • Open source and cost benefits

Linux On Your Desktop

If you would like to use your own Linux OS, you will need to install it. Having your own Linux system offers a great learning opportunity and gives you access to a large library of software.

The installation process transfers the live image to a disk (or flash memory) and configures the system. The OS requires compatible hardware.

For most distribution the installation involves a guided graphical environment and it is easy to accomplish.

Linux on the Server (vs. Windows)

Stability
Greater reliability, less crash, better for large number of processes because of UNIX roots
Security
Unix security roots, less vulnerable to virus and malware
Hardware
Slim, trim, flexible and scalable
Total Cost of Ownership
Licensing and community-based
Freedom
Ability to modify the source code to add non-existant features or fix bugs.

Virtualization

Virtualization requires a compatible processor - not all processors support that feature. Most recent multi-core processors support virtualization.

The virtualized OS is installed and run in a window under another OS. The installation can be usually completed from an ISO image. One or more virtual machines can be run at the same time. The guest OS shares the hardware with the host OS and possibly other virtualized systems. Special software is used to manage the entire process this is the “hypervisor”. The guest systems have network access through the host.

Virtualization Software

The selection of virtualization software (which allows creation and running of virtual machines) depends mainly on the host OS, although some are cross-platform.

Other considerations as to virtualization software may be features, support, price and/or personal preferences.

Popular VM software for Windows, Linux, and macOS include:

  • VMware
  • Oracle Virtual Box

Popular Linux virtualization software include:

  • KVM
  • XEN

Server Virtualization

  • Major market today
  • Benefits
  • Consolidation of servers
  • Resource sharing/ increase utilization
  • Energy efficiency
  • Dynamic (change config without reboot): scalability and elasticity
  • Basis for CLOUD computing

Virtualization Benefits

Software testing
Try a new OS without changing your existing one. Study malware.
Network simulation
Build entire networks on your laptop!
Server consolidation
Run multiple servers on the same physical computer. Save hardware costs and energy
  • Easier disaster recovery:: A virtual machine is stored as a single file on disk.

Virtualization Pros and Cons

Pros Cons
Standalone Fast and Simple. Example: refurbish old PC All resources are committed to a single OS
Partition Can boot one system with multiple OS Example: Enable Mac to run Windows Resources are partitioned
Virtualized Run multiple OS on single system Example: Consolidated system on laptop or machine room Virtualization overheads

Basic Linux System Administration

Running your own system requires completing some administrative tasks, such as:

  • Updating the system
  • Installing and removing software packages
  • Managing users and hardware
  • Running backups
  • File and printer sharing

Most Linux distributions have GUI applications which allow you to complete the above. Keep in mind, that seasoned administrators tend to use the command line to manage their systems.

Software Packages on Knoppix

Knoppix comes with an easy to use GUI interface to manage software packages on your system. This is used to install, update and remove software This utility connects to an on-line repository to access thousands of free software titles. The system is configured to find the nearest mirror automatically.

Other software can be obtained from other repositories, but you will need to configure your system to connect to them.