Difference between revisions of "OPS235 Lab 2 - CentOS7 - VMware"

From CDOT Wiki
Jump to: navigation, search
(Redirected page to OPS235)
 
(127 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:OPS235]]
+
#REDIRECT [[OPS235]]
 
 
 
 
= LAB PREPARATION =
 
 
 
 
 
== Purpose / Objectives of Lab2==
 
[[Image:vmware-1.png|thumb|right|350px|At the end of lab2, your VMware Workstation application will contain '''4 virtual machines'''. You will now have the option to run one virtual machine at a time, or run all machines simultaneously to learn about networking (covered in later labs) ]]
 
 
 
'''In this lab, you will create another three virtual machines''' to learn how to install Centos Linux in different ways including network installs.
 
<br><br>
 
<u>Main Objectives</u>
 
 
 
* '''Create 3 separate VMs (virtual machines) using different installation methods:'''
 
:* Centos Live DVDInstallation
 
:* Network Centos Installation without configuration file
 
:* Network Centos 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.
 
* Create and run '''Bash Shell scripts''' to automate routine tasks.
 
 
 
 
 
==Minimum Required Materials==
 
 
 
{|cellpadding="15" width="40%"
 
 
 
|- valign="top"
 
 
 
|width="10%" |[[Image:ubs-key.png|thumb|left|85px|<b>USB key</b><br>(for backups)]]
 
 
 
|width="10%" |[[Image:log-book.png|thumb|left|70px|<b>Lab2 Log Book</b>]]
 
 
 
|}
 
 
 
==My Toolkit (CLI Reference)==
 
 
 
{|width="100%" cellpadding="15"
 
|- valign="top"
 
|width="20%" |<u>Virtualization:</u>
 
x<br>
 
x
 
|width="20%" |<u>Commands</u>
 
[http://unixhelp.ed.ac.uk/CGI/man-cgi?gzip gzip, gunzip]<br>
 
[http://unixhelp.ed.ac.uk/CGI/man-cgi?grep grep]<br>
 
[http://man7.org/linux/man-pages/man1/wc.1.html wc]<br>
 
[http://man7.org/linux/man-pages/man1/pwd.1.html pwd]<br>
 
[http://man7.org/linux/man-pages/man1/ls.1.html ls]<br>
 
[http://man7.org/linux/man-pages/man1/more.1.html more]<br>
 
[http://man7.org/linux/man-pages/man1/file.1.html file]<br>
 
[http://man7.org/linux/man-pages/man1/wget.1.html wget]<br>
 
[http://man7.org/linux/man-pages/man1/chmod.1.html chmod]<br>
 
[http://ss64.com/vi.html vi]
 
|width="20%" |<u>Installation Guides</u>
 
[http://wiki.centos.org/HowTos/KVM Installing &amp; Using KVM on CentOS ]<br>
 
[http://www.dedoimedo.com/computers/kvm-intro.html Using KVM (tutorial)]<br>
 
[https://www.centos.org/docs/5/html/5.2/Virtualization/sect-Virtualization-Commands_for_Red_Hat_Virtualization-virsh_the_command_line_interface_tool_for_virtualization.html virsh command reference ]<br>
 
[http://www.centos.org/docs/5/html/Installation_Guide-en-US/ch-kickstart2.html CentOS Kickstart Reference ]<br>
 
 
 
|width="40%" |{{Admon/tip|Online Linux Command Review|The following tutorial will allow you to learn essential shell scripting skills. Login to your '''Matrix''' account, and issue the pathname to run the online tutorial in Matrix:<br><ul><li>Shell Scripting - Part 2 (Logic & Math Expressions):<br>'''/home/murray.saul/scripting-2'''</li><li>Shell Scripting - Part 3 (Loops)<br>'''/home/murray.saul/scripting-3'''</li></ul>|
 
}}
 
|}
 
 
 
 
 
=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 has a '''comparison chart''' for comparing various Linux installs. You were required in lab1 to record your observation for your '''centos1''' installation.
 
 
 
As you proceed throughout this lab, you will be required to fill in the comparison chart for the remaining 3 virtual machines that you will be installing.
 
 
 
 
 
== Part 1: Installing from a Downloaded Image (Centos7 LIVE CD) ==
 
{| width="40%" align="right" cellpadding="10"
 
|- valign="top"
 
|{{Admon/tip|Perform Downloads and Network installs at Seneca|'''It is recommended to perform this lab in one of Seneca College's labs'''. This lab uses servers which are on the Seneca network and which are not available from other locations (such as your home). If you attempt this lab from another location, adjust the belmont.senecac.on.ca URLs to point to another mirror server -- note that you may need to change the directory name as well as the server name. The installation of the '''centos4''' virtual machine <u>must</u> be done at Seneca.}}
 
|}
 
 
 
:'''VM Details:'''
 
 
 
:: '''VM Name (and hostname):'''  centos2
 
:: '''Boot media:''' LIVE CD Image
 
:: '''Installation source:''' Downloaded Centos7 LIVE CD image (http://belmont.senecac.on.ca/centos/7/isos/x86_64/CentOS-7-x86_64-LiveGNOME-1511.iso)
 
:: '''VM Image Pathname:''' /var/lib/libvirt/images/centos2.img
 
:: '''Memory:''' 2GB
 
:: '''Disk space:''' 10GB
 
:: '''File System (root partition):''' ext4
 
:: '''CPUs:''' 1
 
 
 
+++ Discuss the concept of installing a Linux Image file as opposed to a Linux Install DVD +++
 
 
 
# Open a web-browser, copy and paste the following URL into the web-browser to download the following Linux image file:<br><br><b><code><span style="color:#3366CC;font-size:1.2em;">wget http://belmont.senecac.on.ca/centos/7/isos/x86_64/CentOS-7-x86_64-LiveGNOME-1511.iso</span></code></b><br><br>
 
# Make certain you used the wget command to download the LiveGNOME iso file from the Belmont server (from previous instructions).
 
# 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:'''Select '''Local install media''' and click '''Forward'''.
 
# '''Step 2 of 5:''' Select '''Use ISO Image''', click the '''Browse''' button, and then the '''Browse Local''' button. Navigate to the location of the downloaded Centos7 LIVE CD image, select the image file and click '''Open'''. When finished, click Forward to proceed.
 
# '''Step 3 of 5:''' Set the memory to '''2048 MB''' and the number of CPUs to '''1'''
 
[[Image:vm-path.png|thumb|right|300px|It is extremely important to '''correctly specify the VM image file path-name'''. Double-check the spelling of the path-name before proceeding!]]
 
<ol><li value="10">'''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'''. Click on<br> '''Select managed or other existing storage''' and type the VM image file pathame:<br> '''/var/lib/libvirt/images/centos2.img'''  (make certain that the pathname is correct) and then click '''Forward''' to proceed.</li><li>'''Step 5 of 5:''' Enter the virtual machine name: '''centos2'''. Review the VM information, and click '''Finish'''.<br><br></li><li>'''The virtual machine will now start''' - start timing your installation and making notes for '''centos2''' virtual machine in the installation comparison chart in lab2 logbook. 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 hard-drive first.</li><li>Double-click '''Install to Hard Drive'''. The installation program, similar to the one used when installing CentOS in Lab 1, will appear. You basically perform the same installation operations for this VM including for '''Date & Time''', '''Network & Hostname''', and '''Installation Destination'''. Make certain to use the '''hostname''': '''<u>centos2</u>''' as opposed to ''centos1'') for this installation.  (with a few slight differences).</li><li>For '''Installation Destination''', select the destination option: '''I will configure partitioning''' and then click '''Done'''. Make certain that the '''Partition Scheme''' is set to '''LVM''' and then click on the link: '''Click to Create Automatically'''. '''Done'''. Check to make certain that the root partition has file system type: '''ext4'''.</li><li>Accept the changes and then click '''Begin Installation'''.<ol type="a"><li>You will be required to make selections very similar to what you did in lab1.</li><li>While the system is installing, take a few minutes to record your observations (including slight differences with centos2 install as opposed to centos1 install).</li><li>When the installation process is complete, note the time required to install this system and record in the installation comparison chart of your lab2 logbook.<br><br></li></ol></li><li>Power-off your Centos7 LIVE system.</li><li>You should notice that the Centos7 boot menu appears. Either press '''ENTER''' to start or wait for it to start automatically.</li><li>Finish the final steps in the setup process (like you did in lab1).</li><li>#You may want to turn off the screen-saver (like you did in Lab1): [http://zenit.senecac.on.ca/wiki/index.php/OPS235_Lab_1_-_CentOS7#Customizing_Your_Account How to Turn-off Screen Saver (lab1)]</li></ol>
 
{| width="40%" align="right" cellpadding="10"
 
|- valign="top"
 
|colspan="2"|{{Admon/important|Network / Service Considerations|Please perform the tasks below in order allow these CentOS systems to be able to communicate with each other. '''Failure to properly perform these operations can cause problems in future labs'''.|
 
}}
 
|}
 
<ol>
 
<li value="20">Enable SSH access to your virtual machine with these commands (semi-colon allows commands to be run in sequence):<br /> <b><code><span style="color:#3366CC;font-size:1.2em;">service sshd start; chkconfig sshd on</span></code></b></li>
 
<li>Find out the IP address of your virtual machine and the name of your Ethernet network adaptor: <b><code><span style="color:#3366CC;font-size:1.2em;">ifconfig</span></code></b> </li>
 
<li>Enter the following command on your virtual machine to create a firewall exception to allow ssh traffic into the machine:<br />  <b><code><span style="color:#3366CC;font-size:1.2em;">iptables -I INPUT -p tcp -s0/0 -d0/0 --dport 22 -j ACCEPT</span></code></b></li><li>If you are logged in as root, logout to your regular user account.</li><li>Confirm that you can ssh to your virtual machine from the host (your main CentOS installation): <b><code><span style="color:#3366CC;font-size:1.2em;">ssh regularuserid@IPaddress</span></code></b> (where '''regularuserid''' is your regular user login id, and '''IPaddress''' is the '''IP_ADDRESS''' of your '''centos2''' VM!).</li><li>Make certain to '''disable SELinux for centos2''' (refer to lab1)</li><li>Adjust your screen-saver settings and run a '''yum update''' on your centos2 VM before proceeding to ''Part 2''</li></ol>
 
 
 
 
 
 
 
 
 
 
 
'''Answer the Investigation 1 observations / questions in your lab log book.'''
 
 
 
== Part 2: Installing from a Network ==
 
{| width="40%" align="right" cellpadding="10"
 
|- valign="top"
 
|colspan="2"|{{Admon/important|Authenticate to the network|The rest of this lab uses network access.''' Be sure to authenticate to the network using your browser before proceeding'''.}}
 
|}
 
 
 
:'''VM Details:'''
 
 
 
:: '''VM Name (and hostname):''' centos3
 
:: '''Boot media:''' Network installation
 
:: '''Installation source URL:''' http://belmont.senecac.on.ca/centos/7/os/x86_64/
 
:: '''VM Image Pathname:''' /var/lib/libvirt/images/centos3.img
 
:: '''Memory:''' 2048MB
 
:: '''Disk space:''' 20GB
 
:: '''CPUs:''' 1
 
 
 
 
 
# Create the VM (called '''centos3''') as you did with the ''centos1'' machine, except for the following differences:<br><br><ol type="a"><li>Select '''Network Installation''' using the installation source URL displayed above.</li><li>When customizing your partitions, do the same operation that you did in centos2, but after automatically creating the partitions, reduce the size of the root LVM partition to '''8000 MB''' and add an LVM partition with a size of '''2000 MB''' (mount point: '''/home''', name: '''home''', and make certain root and /home partitions have '''ext4''' file system).</li><li>Don't forget to install the GNOME desktop here as you will need a GUI for Centos3<br><br></li></ol>
 
# Complete the installation. Login to your regular user account, and perform a yum update for the centos3 VM (reboot if required). Make certain to adjust your screen-saver settings if desired.
 
# Repeat the steps as you did to '''start the SSH service''', '''set iptables to accept connections via ssh''', '''test connections between centos3 and centos1''', and '''disable SELinux''' (refer to lab1).
 
# Record the time taken to install, and compare this to the time taken by the previous installations. Record your findings in the Installation Comparison chart in lab2 logbook.
 
 
 
'''Answer the Investigation 2 observations / questions in your lab log book.'''
 
 
 
== Part 3: Installing from a Network using a Kickstart File ==
 
 
 
:'''VM Details:'''
 
 
 
:: '''VM Name (and hostname):''' centos4
 
:: '''Boot media:''' Network installation
 
:: '''Installation source URL:''' http://belmont.senecac.on.ca/centos/7/os/x86_64/
 
:: '''Kickstart File URL:''' http://matrix.senecac.on.ca/~andrew.smith/ops235/centos7-kickstart-v01.cfg
 
:: '''VM Image Pathname:''' /var/lib/libvirt/images/centos4.img
 
:: '''Memory:''' 2048MB
 
:: '''Disk space:''' 15GB
 
:: '''CPUs:''' 1
 
 
 
 
 
# Create the VM as you did with the ''centos3'' virtual machine, specifying a network install as before, but specify the kickstart location under the "options section" for network install. What do you think is the purpose of this kickstart file?
 
# Observe the installation. How is it different from booting from a downloaded image?
 
# Complete the installation. Record the time taken to install, and compare this to the time taken by the previous installations.<br><br>If the during the installation, you see the message at the bottom '''Pane is Dead''', click the '''Virtual Machine''' menu at the top, select '''Shut Down''' -> '''Force Off''', '''right-click''' on '''centos4''' in the ''virtual manager'' window and select '''Delete'''. Redo the VM setup for a new instance of the ''centos4'' VM.
 
# What happens when the installation is finished?
 
# Take a look at the kickstart file (eg. view url in a webj-browser) to determine the root password as well as the name and password for the first user account!
 
# Boot the virtual machine and log in (use the user ID and password information from the previous step). Compare the experience to the first time you booted the other virtual machines. Record this information in the '''table contained in Investigation 4'''.
 
# Repeat the steps as you did to '''start the SSH service''', '''set iptables to accept connections via ssh''', '''test connections between centos4 and centos1''', and '''disable SELinux''' (refer to lab1).
 
# Remember that centos4 is text-based interface only (no graphics). To recover from a blank screen, press a key (like the SPACE key) to return to the screen display.
 
# Record the time taken to install, and compare this to the time taken by the previous installations. Record your findings in the Installation Comparison chart in lab2 logbook.
 
 
 
 
 
 
 
= LAB 2 SIGN-OFF (SHOW INSTRUCTOR) =
 
{{Admon/important|Time for a new backup!|If you have successfully completed this lab, make a new backup of your virtual machines as well as your host machine.}}
 
 
 
'''Arrange proof of the following on the screen:'''
 
 
 
<ol><li><span style="color:green;font-size:1.5em;">&#x2713;</span> '''<u>All</u> VMs''':<blockquote><ul><li>Working virtual machines '''created''' and '''running'''</li><li>'''Disk layout''' and '''size''' correct on all virtual machines</li><li> Proof of '''yum updates'''</li><li>'''All virtual machines backed-up''' (eg. usb stick and/or home directory)</li></ul></blockquote></li><li><span style="color:green;font-size:1.5em;">&#x2713;</span>'''centos1''' machine:<blockquote><ul><li>'''Correct VM image filenames''' contained in '''/var/lib/libvirt/images directory'''</li><li>Creation of your bash shell script called '''backupVM.bash'''</li><li>A list of your '''iptables''' rules (command: '''iptables -L''')</li></ul></blockquote></li><li><span style="color:green;font-size:1.5em;">&#x2713;</span> Lab2 logbook notes and '''Installation Comparison chart''' completed</li></ol>
 
 
 
== Practice For Quizzes, Tests, Midterm &amp; Final Exam ==
 
 
 
# What is the name of the CentOS installation program?
 
# What is the name of the file created by the CentOS installation program?
 
# Which type of installation works best for confirming compatibility with hardware before installation? Why?
 
# Which type of installation works best for installing large numbers of computers? Why?
 
# How can you reduce the number of software updates required immediately after installation?
 
# How do you start and stop virtual machines?
 
# How do you SSH into your virtual machines?
 
# What is procedure to backup your VM images (and XML config files) to your USB key?
 
# The kickstart installation (centos4) was a network installation. Can a kickstart file be used with a DVD installation?
 
# The kickstart installation (centos4) was fairly fast. Why? Under what circumstances would it take a long time, even on a fast network?
 
 
 
 
 
[[Category:OPS235]]
 
[[Category:OPS235 Labs]]
 

Latest revision as of 12:56, 15 September 2016

Redirect to: