Difference between revisions of "OPS335 Installation Lab"

From CDOT Wiki
Jump to: navigation, search
m (Updating link to public mirror list)
(Updating for Fall 2015)
Line 2: Line 2:
  
 
== Objectives ==
 
== Objectives ==
*Install your host machine (Centos 6.5)
+
*Install your host machine (Centos 7)
*Install 3 virtual machines (VMs) (Fedora 20)
+
*Install 3 virtual machines (VMs) (Fedora 22 - Server)
 
*Prepare for lab exercises.
 
*Prepare for lab exercises.
  
 
== Required materials ==
 
== Required materials ==
*Centos 6.5 Installation DVD
+
*Centos 7 Installation DVD
 
*One SATA hard disk in a removable drive tray (minimum 160GB) - It is strongly advised you dedicate a drive for this course only.
 
*One SATA hard disk in a removable drive tray (minimum 160GB) - It is strongly advised you dedicate a drive for this course only.
 
*Recommended - USB drive (8 GB+) for creating and storing backups (Virtual Machines, configuration files)
 
*Recommended - USB drive (8 GB+) for creating and storing backups (Virtual Machines, configuration files)
Line 13: Line 13:
 
==Part A: Host Installation ==
 
==Part A: Host Installation ==
  
=== Installation instructions for Centos 6.5 ===
+
=== Installation instructions for Centos 7 ===
#Download a copy of the Centos 6.5 installation DVD (64 bit edition) from the Centos web site or burn the DVD using Seneca's Freedom Toaster which is located in the Open Lab on the 2nd floor of the TEL building. Note: we'll be using the 64 bit version of Centos because all of our lab computers are equiped with Intel 64 bit mainboards and CPUs. We'll also be using a Fedora iso for installing the virtual machines, but you will not need to burn that to a disc.  It is faster to download the ISO and install directly from it.
+
#Download a copy of the Centos 7 installation DVD (64 bit edition) from the Centos web site or belmont. Note: we'll be using the 64 bit version of Centos because all of our lab computers are equiped with Intel 64 bit mainboards and CPUs. We'll also be using a Fedora iso for installing the virtual machines, but you will not need to burn that to a disc.  It is faster to download the ISO and install directly from it.
#* '''Seneca's mirror of Centos:''' http://belmont.senecac.on.ca/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1.iso <br />(This is very fast, but is only accessible from within Seneca's network  - you can't access this from home. You can burn this disc on the machines in the Open Lab.)<br />
+
#* '''Seneca's mirror of Centos:''' http://belmont.senecac.on.ca/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1503-01.iso <br />(This is very fast, but is only accessible from within Seneca's network  - you can't access this from home. You can burn this disc on the machines in the Open Lab.)<br />
#* '''Centos mirror list:''' http://isoredirect.centos.org/centos/6/isos/x86_64/<br />(Accessible from any Internet connection.)<br />
+
#* '''Centos mirror list:''' https://www.centos.org/download/mirrors/<br />(Accessible from any Internet connection.)<br />
 
#Insert your HDD into the docking bay of a PC in the lab and boot the computer using your installation DVD. If possible try to use the same PC for this course for the rest of the semester. Some PCs may be configured with slight hardware variations from others which may cause problems when moving your HDD from one system to another.  
 
#Insert your HDD into the docking bay of a PC in the lab and boot the computer using your installation DVD. If possible try to use the same PC for this course for the rest of the semester. Some PCs may be configured with slight hardware variations from others which may cause problems when moving your HDD from one system to another.  
 
#Perform your installation following these guidelines:
 
#Perform your installation following these guidelines:
Line 34: Line 34:
 
#*Verify that your system date and time are correct. If not then set the correct system date and time.
 
#*Verify that your system date and time are correct. If not then set the correct system date and time.
 
#*Verify that your network is functioning.
 
#*Verify that your network is functioning.
 +
#**If you do not have an ip address, edit the line in /etc/sysconfig/network-scripts/ifcfg-eth0 (note this file name may differ between machines).
 +
  onboot=no
 +
should be
 +
  onboot=yes
 +
*If you had to change that, reboot your machine before continuing.
 
#*Run and record the output of the 'df -hT' command.
 
#*Run and record the output of the 'df -hT' command.
 
#*Run and record the output of the 'cat /etc/fstab' command.
 
#*Run and record the output of the 'cat /etc/fstab' command.
 
#*Run and record the output of the 'cat /etc/issue' command.
 
#*Run and record the output of the 'cat /etc/issue' command.
 
#*Run and record the output of the 'uname -a' command.
 
#*Run and record the output of the 'uname -a' command.
 +
 +
===Using iptables===
 +
The most recent variants of Centos and Fedora are using a service that replaces iptables, however the service is still in relatively common usage.  In this course we will keep running iptables on the host machine, and gain experience with the new service on the virtual machines.
 +
*install and enable iptables
 +
yum install iptables-services
 +
systemctl enable iptables
 +
*disable firewalld
 +
systemctl disable firewalld
 +
*Note that the machine will not switch over to using iptables until you reboot, but you will be doing that shortly, so there is no need to do so right now.
  
 
===Configuring a Linux Gateway===
 
===Configuring a Linux Gateway===
At this point you have a basic Centos 6.5 installed and updated.  This will serve as a host for the virtual machines where you will do the majority of the work in this course.  All the rest of our labs will assume you have this basic system running. If, for any reason, your system becomes corrupted during the semester, you'll have to redo this lab to be able to continue with the remaining uncompleted labs. You are responsible for YOUR system. If you do not perform back-ups you have taken this risk on yourself. Poor planning on your part does not constitute an emergency for anyone else.
+
At this point you have a basic Centos system installed and updated.  This will serve as a host for the virtual machines where you will do the majority of the work in this course.  All the rest of our labs will assume you have this basic system running. If, for any reason, your system becomes corrupted during the semester, you'll have to redo this lab to be able to continue with the remaining uncompleted labs. You are responsible for YOUR system. If you do not perform back-ups you have taken this risk on yourself. Poor planning on your part does not constitute an emergency for anyone else.
  
 
*You will need to install some software to allow your machine to act as a host for virtual machines
 
*You will need to install some software to allow your machine to act as a host for virtual machines
yum groupinstall virtualization
 
 
  yum install virt-manager libvirt
 
  yum install virt-manager libvirt
 
*Start and enable the virtualization service
 
*Start and enable the virtualization service
  service libvirtd start
+
  systemctl start libvirtd
  chkconfig libvirtd on
+
  systemctl enable libvirtd
*Note that when starting libvirtd you may receive a warning 'virGetHostname: getaddrinfo failed for "Machine Name": Name or service not known.  This will not interfere with your machines.
 
 
*Reboot your machine.  If you do not, you will not be able to install any virtual machines.
 
*Reboot your machine.  If you do not, you will not be able to install any virtual machines.
 
*Start the graphical virtual machine manager
 
*Start the graphical virtual machine manager
Line 68: Line 80:
 
==Part B: Virtual Machine Installation ==
 
==Part B: Virtual Machine Installation ==
 
With the virtualization software installed and your personal network created, you are now ready to create your first virtual machine.  If you have an installation DVD for Fedora you can use that, but it will be much faster to download the iso from belmont and install directly from it.
 
With the virtualization software installed and your personal network created, you are now ready to create your first virtual machine.  If you have an installation DVD for Fedora you can use that, but it will be much faster to download the iso from belmont and install directly from it.
   wget http://belmont.senecac.on.ca/fedora/releases/20/Fedora/x86_64/iso/Fedora-20-x86_64-DVD.iso
+
   wget http://belmont.senecac.on.ca/fedora/releases/22/Fedora/x86_64/iso/Fedora-Server-DVD-x86_64-22.iso
   If it has not been made available use the publicly available mirrors
+
   If it has not been made available use the publicly available link
   https://admin.fedoraproject.org/mirrormanager/mirrors/Fedora/20/x86_64
+
   https://download.fedoraproject.org/pub/fedora/linux/releases/22/Server/x86_64/iso/Fedora-Server-DVD-x86_64-22.iso
 
===Installation===
 
===Installation===
 
*Click on the icon "Create a new virtual machine" to begin.
 
*Click on the icon "Create a new virtual machine" to begin.
*Name your machine "f20-vm1" and choose your installation method - "Local install media". Choose the desired option to install from either the CD or iso. For "OS type" select "Linux" and for Version select "Fedora 18 or later" then click on the "Forward" button.
+
*Name your machine "f22-vm1" and choose your installation method - "Local install media". Choose the desired option to install from either the CD or iso.
 
*Use the default memory and CPU options for use with lab computers (Depending on available hardware these settings can be adjusted). Then click on the "Forward" button to proceed.
 
*Use the default memory and CPU options for use with lab computers (Depending on available hardware these settings can be adjusted). Then click on the "Forward" button to proceed.
 
*Leave the disk image size set at 8GB, ensure "Allocate entire disk now" is checked, then click on the "Forward" button.
 
*Leave the disk image size set at 8GB, ensure "Allocate entire disk now" is checked, then click on the "Forward" button.
Line 84: Line 96:
  
 
===First Boot===
 
===First Boot===
*You may notice that graphical windows are not being displayed properly.  The following steps will resolve this.
+
*You will notice that the server installation defaults to a command-line interfaceThis is normal, and we will only be using this interface during this course.
**At the first opportunity, shut the VM downIf you perform these steps while the machine is running it will claim they will be applied the next time the machine boots, but that does not work.
 
**While the VM is off, click on 'View' (from the menu at the top of the VM window), and select 'Details'.
 
**From the menu on the left side, select 'Video'.
 
**Change the drop-down list for Model from 'Cirrus' to 'vga', and click apply.
 
**Switch the view back to 'Console' and start the machine again.
 
 
*Ensure your machine has a network connection by running the command
 
*Ensure your machine has a network connection by running the command
 
  host cbc.ca
 
  host cbc.ca
Line 113: Line 120:
  
 
===Cloning a Virtual Machine===
 
===Cloning a Virtual Machine===
*Now that you have one virtual machine working, you will create two more.  If you struggled with the previous steps, repeat them to create two more virtual machines (naming them f20-vm2 and f20-vm3, with hostnames vm2.localdomain and vm3.localdomain respectively).
+
*Now that you have one virtual machine working, you will create two more.  If you struggled with the previous steps, repeat them to create two more virtual machines (naming them f22-vm2 and f22-vm3, with hostnames vm2.localdomain and vm3.localdomain respectively).
 
*If you are confident with what you have done so far, you may clone your existing machine to create the others.
 
*If you are confident with what you have done so far, you may clone your existing machine to create the others.
**To quickly create additional VM's shutdown 'f20-vm1', right click and select 'Clone...'.
+
**To quickly create additional VM's shutdown 'f22-vm1', right click and select 'Clone...'.
***Set the Name to be: f20-vm2
+
***Set the Name to be: f22-vm2
 
**Once successfully created, boot the new VM and correct the host name. This can be done using the GUI or command line.  
 
**Once successfully created, boot the new VM and correct the host name. This can be done using the GUI or command line.  
 
***Record in your notes how each is done.
 
***Record in your notes how each is done.
 
**Use the host command to check for connectivity
 
**Use the host command to check for connectivity
**After creating f20-vm2 repeat the above steps to create f20-vm3 and correct the host name.
+
**After creating f22-vm2 repeat the above steps to create f22-vm3 and correct the host name.
  
 
== Completing the Lab ==
 
== Completing the Lab ==
Upon completion of this lab you should have 4 installed machines.  One machine running Centos 6.5 and acting as a host and gateway for three virtual machines running Fedora 20Make sure that each machine can access the network (for example, to get updates) and can ping each other.
+
Upon completion of this lab you should have 4 installed machines.  One machine running Centos 7 and acting as a host and gateway for three virtual machines running Fedora 22 ServerEach machine must have access to the network (for example, to get updates) and be able ping the others.
  
 
Exploration questions:
 
Exploration questions:

Revision as of 11:18, 31 August 2015


Objectives

  • Install your host machine (Centos 7)
  • Install 3 virtual machines (VMs) (Fedora 22 - Server)
  • Prepare for lab exercises.

Required materials

  • Centos 7 Installation DVD
  • One SATA hard disk in a removable drive tray (minimum 160GB) - It is strongly advised you dedicate a drive for this course only.
  • Recommended - USB drive (8 GB+) for creating and storing backups (Virtual Machines, configuration files)

Part A: Host Installation

Installation instructions for Centos 7

  1. Download a copy of the Centos 7 installation DVD (64 bit edition) from the Centos web site or belmont. Note: we'll be using the 64 bit version of Centos because all of our lab computers are equiped with Intel 64 bit mainboards and CPUs. We'll also be using a Fedora iso for installing the virtual machines, but you will not need to burn that to a disc. It is faster to download the ISO and install directly from it.
  2. Insert your HDD into the docking bay of a PC in the lab and boot the computer using your installation DVD. If possible try to use the same PC for this course for the rest of the semester. Some PCs may be configured with slight hardware variations from others which may cause problems when moving your HDD from one system to another.
  3. Perform your installation following these guidelines:
    • wherever possible select the default options
    • set your hostname to your Seneca username.
    • set Toronto as your time zone
    • When given the option, click 'review and modify partition layout'. A typical installation devotes most of the available space to a logical volume for /home. You will have fewer users and more virtual machines than a typical installation, so the default allocation will not work for this course. Reduce the size of lv_home (minimum 10GB), and create a new logical volume for /var (called lv_var) and give it the space made available by shrinking lv_home (You will need enough space for 6 virtual machines at 8GB each). Note that this is case sensitive.
    • For the installation type, choose 'Desktop'
    • set the root password
  4. After completing the installation, remove the DVD and reboot from your HDD.
Idea.png
Tip: Boot Menu
If you got the boot failure message, restart the computer and press [F10] to get to the boot menu, select the Hard Disk as boot device and continue.

Booting your system

  1. create a user named with your learn ID
  2. Login as the user you created and open a terminal window. Then use 'su' to become root and run the 'yum update' command. Reboot after all updates have completed. Now that your system is up to date, again login using your learnid and do the following:
    • Verify that your system date and time are correct. If not then set the correct system date and time.
    • Verify that your network is functioning.
      • If you do not have an ip address, edit the line in /etc/sysconfig/network-scripts/ifcfg-eth0 (note this file name may differ between machines).
 onboot=no

should be

 onboot=yes
  • If you had to change that, reboot your machine before continuing.
    • Run and record the output of the 'df -hT' command.
    • Run and record the output of the 'cat /etc/fstab' command.
    • Run and record the output of the 'cat /etc/issue' command.
    • Run and record the output of the 'uname -a' command.

Using iptables

The most recent variants of Centos and Fedora are using a service that replaces iptables, however the service is still in relatively common usage. In this course we will keep running iptables on the host machine, and gain experience with the new service on the virtual machines.

  • install and enable iptables
yum install iptables-services
systemctl enable iptables
  • disable firewalld
systemctl disable firewalld
  • Note that the machine will not switch over to using iptables until you reboot, but you will be doing that shortly, so there is no need to do so right now.

Configuring a Linux Gateway

At this point you have a basic Centos system installed and updated. This will serve as a host for the virtual machines where you will do the majority of the work in this course. All the rest of our labs will assume you have this basic system running. If, for any reason, your system becomes corrupted during the semester, you'll have to redo this lab to be able to continue with the remaining uncompleted labs. You are responsible for YOUR system. If you do not perform back-ups you have taken this risk on yourself. Poor planning on your part does not constitute an emergency for anyone else.

  • You will need to install some software to allow your machine to act as a host for virtual machines
yum install virt-manager libvirt
  • Start and enable the virtualization service
systemctl start libvirtd
systemctl enable libvirtd
  • Reboot your machine. If you do not, you will not be able to install any virtual machines.
  • Start the graphical virtual machine manager
    • You will need to enter your root password.
  • Create your own virtual network.
    • A default one has been created for you, but you will be using a custom one in this course.
  1. Right click 'localhost (QEMU)' and select 'Details'. Click on the 'Virtual Networks' tab.
  2. Stop and delete the 'default' network.
  3. Run, and record the output of the following command: iptables -t nat -L
  4. Use the plus sign to add a new virtual network using the following options.
    • Name your virtual network 'ops335'
    • Use the last two digits of your student number for the third octet of network IP address. Example, if your student number is 000-000-090, the network address would be 192.168.90.0/24.
    • Ensure the DHCP range will allow you to assign at least 3 static IP addresses outside it.
    • Choose 'Forwarding to physical network' radio button, 'Destination: Any physical device' and 'Mode: NAT'
    • Ensure the network is started at boot.
  5. Once completed open a terminal and observe and record the output of the following command (noting the difference from the last time you ran it. We will discuss it in a few weeks):
iptables -t nat -L

Part B: Virtual Machine Installation

With the virtualization software installed and your personal network created, you are now ready to create your first virtual machine. If you have an installation DVD for Fedora you can use that, but it will be much faster to download the iso from belmont and install directly from it.

 wget http://belmont.senecac.on.ca/fedora/releases/22/Fedora/x86_64/iso/Fedora-Server-DVD-x86_64-22.iso
 If it has not been made available use the publicly available link
 https://download.fedoraproject.org/pub/fedora/linux/releases/22/Server/x86_64/iso/Fedora-Server-DVD-x86_64-22.iso

Installation

  • Click on the icon "Create a new virtual machine" to begin.
  • Name your machine "f22-vm1" and choose your installation method - "Local install media". Choose the desired option to install from either the CD or iso.
  • Use the default memory and CPU options for use with lab computers (Depending on available hardware these settings can be adjusted). Then click on the "Forward" button to proceed.
  • Leave the disk image size set at 8GB, ensure "Allocate entire disk now" is checked, then click on the "Forward" button.
  • At the "Ready to begin installation" window click on 'Advanced options' arrow to review available options.
    • Select the Virtual Network named 'ops335'. Make note of any other available options (you will need them again in the assignments).
  • Select 'Install to Hard Drive' to begin your Fedora installation. Select the appropriate default options (You may wish to review your OPS235 notes to remind yourself what these are).
  • During installation you will be prompted to set the root password and an initial user account. For the initial user, enter the same information you entered on your host machine.
  • Set your hostname to "vm1.localdomain".
Important.png
Firstboot - First user created
For successful completion of the labs, please ensure the first user created is named using your Seneca username.

First Boot

  • You will notice that the server installation defaults to a command-line interface. This is normal, and we will only be using this interface during this course.
  • Ensure your machine has a network connection by running the command
host cbc.ca

If that did not work, edit the line in /etc/sysconfig/network-scripts/ifcfg-eth0

 onboot=no

should be

 onboot=yes
  • If you had to change that, reboot your machine.
  • Once you have a working connection update your machine (this may take a while).
 yum update
  • Reboot the virtual machine once it is updated.
  • If your virtual machine hangs on boot, you will need to change a graphics option:
    • While the VM is off, click on 'View' (from the menu at the top of the VM window), and select 'Details'.
    • From the menu on the left side, select 'Display'.
    • Change the drop-down list for Type from 'VNC' to 'Spice', and click apply.
    • Switch the view back to 'Console' and start the machine again.
  • Now run the following commands and note the output. Note how they differ from the Centos installation on your host.
 df -hT
 cat /etc/fstab
 cat /etc/issue
 uname -a

Cloning a Virtual Machine

  • Now that you have one virtual machine working, you will create two more. If you struggled with the previous steps, repeat them to create two more virtual machines (naming them f22-vm2 and f22-vm3, with hostnames vm2.localdomain and vm3.localdomain respectively).
  • If you are confident with what you have done so far, you may clone your existing machine to create the others.
    • To quickly create additional VM's shutdown 'f22-vm1', right click and select 'Clone...'.
      • Set the Name to be: f22-vm2
    • Once successfully created, boot the new VM and correct the host name. This can be done using the GUI or command line.
      • Record in your notes how each is done.
    • Use the host command to check for connectivity
    • After creating f22-vm2 repeat the above steps to create f22-vm3 and correct the host name.

Completing the Lab

Upon completion of this lab you should have 4 installed machines. One machine running Centos 7 and acting as a host and gateway for three virtual machines running Fedora 22 Server. Each machine must have access to the network (for example, to get updates) and be able ping the others.

Exploration questions:

  1. What is the code name of your installed Fedora Linux system? How did you determine this?
  2. What kernel release is your host system running?
  3. What kernel release are your virtual machines running?
  4. What is the UUID (Universally Unique Identifier) of your root file system? What command was used to obtain this information?
  5. What is the size and type of the /boot file system on your host?
  6. What file was edited to change the host name on your VM's?
  7. Explain the iptables rules displayed when you ran the command 'iptables -t nat -L'. How did they change after creating your personal network.