OPS235 Lab 2 - CentOS7
Contents
LAB PREPARATION
Purpose / Objectives of Lab2
In this lab, you will create three virtual machines. This also gives you an opportunity to experiment with different ways of installing CentOS. You will be learning the following elements of Virtualization in this lab:
- Installing Virtualization Software on your c7host machine
- Create 3 separate VMs (virtual machines) using different installation methods:
- Centos Live DVDInstallation
- Network Installation without configuration file
- Network Installation with configuration file (Kickstart)
- Understand the advantages and disadvantages of each type of installation, and be able to select the best installation method for a particular situation.
- Manipulate virtual machines by CLI (virsh)
- Properly backup VMs and VM configuration in virtual manager application onto home directory and to external source (USB Key)
- Observe how Bash Shell Scripting can be used to automate routine tasks involving VM management
What is a Virtual Machine?
A virtual machine is a software simulation of a computer which can be used as though it were actual hardware. It's possible to run multiple virtual machines on one computer, reducing hardware requirements and introducing flexibility. Some common uses of virtualization include:
- Software testing -- Using multiple operating systems simultaneously on a single computer for testing and experimentation.
- Network simulation -- Testing network services, protocols, and security scenarios with a small number of computers.
- Isolation -- Protecting multiple sets of data by storing them on multiple virtual machines. If one of the virtual machines is compromised, the data on other virtual machines is still protected.
- Server consolidation -- Reducing the number of physical servers in a network by moving physical machines to virtual machines. This saves hardware, administration, cooling, and electricity costs, and it can increase the utilization of hardware (by ensuring that the hardware is not under-loaded).
- Load-balancing and disaster recovery -- It is possible to migrate virtual machines between different physical machines, to ensure that a workload is balanced across multiple computers, to allow routine hardware maintenance and upgrading, and to compensate for hardware failure or other disasters.
Minimum Required Materials
My Toolkit (CLI Reference)
Virtualization: | Installation Guides
Installing & Using KVM on CentOS |
Commands |
INVESTIGATION 1: USING VIRTUALIZATION SOFTWARE TO CREATE VIRTUAL MACHINES
Virtualization Application Setup / Comparison Chart
Record VM Installation in Lab2 (Installation Comparison Chart):
You will be learning to perform several different type of CENTOS Linux installs. Lab2 already has an empty table for comparing various Linux installs. You were required in lab1 to record your observation for your c7host installation.
As you proceed throughout this lab, you will be required to fill in the comparison chart for three of the VMs (virtual machines) that you will be installing.
Complete the following steps to install and run the virtual manager application:
- Open a web-browser, and open the OPS235 Lab #2 WIKI.
- Install the virtualization software by issuing the command:
yum install qemu-kvm qemu-img virt-manager libvirt libvirt-python \
python-virtinst libvirt-client virt-install virt-viewer
- This will install many applications (including):
- kvm/qemu - the hypervisor and other hardware emulation systems.
- A system service named libvirtd that manages the VMs.
- A graphical tool for managing virtual machines (virt-manager) and the virsh command-line tool.
- This will install many applications (including):
- Start the virtualization service:
service libvirtd start
- The firewall configuration is altered by the addition of the virtualization software. Restart the firewall so that these changes become active:
service iptables restart
- Start the graphical tool by selecting the menu options Applications>System Tools>Virtual Machine Manager or by typing the command
virt-manager
Part 1: Installing from a Live Disc
- VM Details:
- Name: centos1
- Boot media: CentOS7 Live DVD
- Installation source: Live DVD
- Memory: 768MB
- Disk space: 10GB
- CPUs: 1
- In the Virtual Machine Manger, click on the icon to Create a Virtual Machine in the upper-left corner:
- A window will appear with the title New VM. There are five steps to be completed; click Forward after each step:
- Step 1 of 5: Enter the virtual machine (called centos1) name and select Local install media
- Step 2 of 5: Insert the DVD containing the Centos Live Disc image. Wait a moment for the disc to be recognized, then select Use CDROM or DVD as the install media. Set the OS type to Linux and the Version to Red Hat Enterprise Linux 7 (the CentOS6 equivalent).
- Step 3 of 5: Set the memory to 768 MB and the number of CPUs to 1
- Step 4 of 5: This next step creates a disk file that will be used to simulate the virtual machine's disk drive. Select a size of 10 GB and checkmark the box labeled Allocate entire disk now
- Step 5 of 5: Review the options that you have selected. Make a note of the storage location. If anything needs to be changed, use the Back button to go back and edit it; otherwise, click Finish
- The virtual machine will now start. The virtual machine is running from the live disc at this point, and no software has been installed on the hard drive of the virtual machine. The point of a live disk is to allow you to test the distribution to see whether you like it without installing to the harddrive first.
- Click Install to Hard Drive. The installation program, similar to the one used when installing CentOS in Lab 1, will appear. You will get a warning at one point during the installation process that the disk "May contain data" or "may need to be re-initialized" -- this is simply a warning that the virtual disk is completely blank, and it is safe to proceed with the installation.
- During the installation process, when prompted for a storage device, first select Specialized Storage Devices, and then select the Virtio Block Device option.
- When prompted for the hostname, enter centos1, and when prompted for the timezone, select Toronto - Eastern Time Ontario
- When asked about storage, select Use All Space. Use the default values for all other fields. Notice that the installer does not ask you what software should be installed; compare the installation time to the amount of time it took to do your Lab 2 installation. Record this information in the table contained in Investigation 4.
- When the installation is complete, click on the reboot button at the bottom right-hand corner of the screen.
- Start the VM from its disk image. This can be done graphically by selecting the Virual machine name, and then clicking on the Open button, and then click the play button when the next screen appears (or by selecting Virtual Machine>Run from the virtual machine menu). You will get the Firstboot configuration questions during the boot process (asking you to create a user, set the date and time, and ignore the kdump out-of-memory warning). Make certain that the VM has a network interface connection (i.e. look at network applet on the top panel). Create a user with the same name as your Matrix account.
- Login using the new user account.
Part 2: Installing from the Network
Answer the Investigation 2 observations / questions in your lab log book. Part 3: Installing from the Network using Kickstart
Answer the Investigation 1 observations / questions in your lab log book. Part 4: Updating the VMs
INVESTIGATION 2: MANAGING VIRTUAL MACHINESPart 1: Managing Virtual Machines from the Command Line
Answer all observations / questions in your lab log book. Part 2: Backing Up Virtual Machines
Answer the Investigation observations / questions in your lab log book. INVESTIGATION 3: LOOKING AHEADPart 1: Automating Routine Tasks (Shell Scripting)We continue the discussion of using Bash Shell Scripts to help automate routine tasks for the Linux system administrator. In lab1, you were exposed to downloading and running Bash Shell Scripts for demonstration purposes. Before showing you demos for this lab, you should learn a few more "shell scripting tricks" in case you need to create your own set of tools for task automation.
Answer all observations / questions in your lab log book. LAB 2 SIGN-OFF (SHOW INSTRUCTOR)Arrange evidence for each of these items on your screen, then ask your instructor to review them and sign off on the lab's completion:
Preparing for Quizzes
|