Lecture Six

Live Linux; Email; scp & sftp; Linux Installation; Virtualization; Basic Linux Administration

Live Linux

  • most major Linux distributions offer a Live version, allowing users to run the OS without installing it
    • usually 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 for:
    • troubleshooting
    • hardware compatibility testing before install
    • virus removal
    • trying out a new/unknown distribution
  • new or changed files can be saved on portable storage (such as a USB memory stick) or on the local hard drive
  • if you wish to try it:
    • the image can be downloaded from the Fedora Project website - fedoraproject.org
    • after download, burn the CD image onto a CD
    • after burning, boot up the CD and play with Fedora, figure out how to access the command-line terminal and the FireFox browser
    • Fedora uses the Gnome Window Manager as the default GUI, the other popular Window Manager is KDE

Email

  • mail (or newer mailx) command can be used to send and receive mail within the server or over the internet
  • mail
    • will allow you to read email, as well as reply, forward, delete, etc.
  • mail username
    • will allow you to write email
    • enter the subject of the email
    • enter the body of the email
    • end by hitting -d on a line by itself
  • can also use an internet email address, for example:
    mail [email protected]
  • can also use a file as the message body, with an optional subject, for example:
    mail [email protected] -s "Subject of this email" < filename

scp & sftp

scp (secure copy)

  • securely copies files over a network
    • transmission is encrypted using SSL
    • files can be transferred between local and remote host as well as between two remote hosts
  • usage is similar to the cp command with the addition of host names, for example:
    • scp local.file user@host:remote-path
    • scp user@host:remote-path local.file
    • scp user1@host1:remote-path1 user2@host2:remote-path2
    • the user name in the command can be omitted if it's the same as on the local host
    • multiple file and recursive directory copy is supported
    • remote-path can be absolute, otherwise it's relative to the home directory

sftp (secure file transfer program)

  • securely copies files over a network
    • transmission is encrypted using SSL
    • files can only be transferred between local and remote host, cannot connect two remote hosts
  • for example:
    • sftp user@host
    • the user name in the command can be omitted if it's the same as on the local host
    • when you connect to a server, your current machine is "local", the server is "remote"
  • to navigate within the remote server:
    • ls - display files in current directory
    • cd - change directory
    • pwd - display absolute path of current directory
  • to navigate within the local machine:
    • !ls - display files in current directory
    • lcd - change directory
    • !pwd - display absolute path of current directory
  • other commands:
    • get filename - get file from remote server to local machine
    • put filename - put file from local machine to remote server
    • mget & mput - can be used for multiple files using wildcards, such as "*"
    • ? - list other availabe commands with a brief description
    • exit - or "bye" or "Ctrl-d"

Linux Installation

  • Linux can be installed directly onto a hard drive, either on a desktop or a server
    • run Live Linux to ensure hardware compatibility, then install
    • very easy, graphical environment during installation
    • advantages over Windows:
      • more stable, fewer crashes, capable of running more simultaneous processes
      • more secure, less vulnerable to viruses and malware
      • more efficient, less hardware intensive, scalable
      • cost savings, lots of open-source software available
    • desktop installation:
      • personal or corporate use
      • open-source community member, many high-quality products available for free
    • server installation:
      • popular as part of LAMP stack (Linux, Apache, MySQL, PHP)
      • open-source, cost benefits
  • stand-alone installation
    • replaces any existing operating system
    • any existing data will be lost
    • a boot loader locates the operating system kernel, loads it into memory, and runs it
    • disk preparation and boot loader installation are usually handled as part of the Linux installation
  • multi-boot installation
    • installed in addition to any existing operating system
    • uses some of the free disk space that was available to the other operating system
    • the boot loader can also start up other operating systems, or provide a menu for operating system selection
    • disk partitioning and boot loader installation are usually handled as part of the Linux installation
  • can run multiple systems simultaneously by using virtualization
    • convenient if you need to use more than one operating system
    • instead of constantly rebooting, can run one or more systems within a window of another

Virtualization

  • a method of running multiple operating systems simultaneously
  • the process is managed by a "hypervisor"
  • guest systems have network access through the host
  • advantages:
    • try out a new operating system without committing
    • study malware
    • network simulation, build a network within one PC
    • server consolidation:
      • resource sharing, increased utilization of hardware
      • energy savings
      • basis of cloud computing
      • easier disaster recovery, each virtual machine is a single file
      • of course, there is some virtualization overhead
  • there are several types of virtualization software for Windows
  • two of the best are VirtualBox and VMWare
  • VirtualBox can be used with Windows and Mac, and can be downloaded from www.virtualbox.org/wiki/Downloads
    • click on "x86/amd64", either on VirtualBox for Windows (PC) or Virtual Box for OS X (Mac) to download VirtualBox
    • install VirtualBox and start it up
    • Note: VirtualBox has an amazingly useful feature, letting you take a snapshot of the current state of a guest operating system; you can try stuff, and if you don't like the results, just go back to a previous snapshot of the system
  • VMWare Player can be used with Windows (there is no free Mac version) and can be downloaded from www.vmware.com/products/player
    • click the "Download" button, then download VMware Player
    • install VMWare Player and start it up
  • two popular VM products for Linux are KVM and XEN

Creating a Virtual Machine

  • within VirtualBox, click on the "New" button, or within VMWare Player, click on "Create a New Virtual Machine"
    • follow the instructions, using a bootable CD or a CD image on disk
    • name your VM whatever you like, and take all the defaults and suggestions offered
    • once the image boots, click "Install to Disk", the same as if you were installing to a physical computer, again taking the defaults
    • during install, don't worry about "this will delete data" types of messages, VirtualBox will ensure that a virtual disk is being used
    • depending on your PC, you may be able to run 64-bit Fedora, if not, then use 32-bit
    • after "Install to Disk", you may need to disable the CD image or change the boot order so that the installed version will boot
    • you can create as many Virtual Machines as you like, not only Fedora, but any other Linux distributions or other operating systems that you may be interested in

Basic Linux Administration

  • the superuser has access to every file on the system, and many command restrictions don't apply
  • to avoid accidents, it's best to login as the superuser only when necessary
  • the superuser is usually userid root
  • can login as root directly, or su (substitute user) to root
  • administrative tasks include:
    • updating system
    • installing and removing software
    • managing users and hardware
    • running backups
    • managing file and printer sharing