Difference between revisions of "OPS335 Installation Lab"
Line 22: | Line 22: | ||
# It may be advisable to obtain a <u>newer version</u> of the Centos 7 Full Installation DVD since there may be improvements since the last version from when you took OPS235. | # It may be advisable to obtain a <u>newer version</u> of the Centos 7 Full Installation DVD since there may be improvements since the last version from when you took OPS235. | ||
# Download and burn on a DVD a copy of the Centos 7 installation DVD (64 bit edition) from the Centos web site or the Belmont server.<br>'''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, and any computer you bought in the last few years for yourself will be 64bit as well. | # Download and burn on a DVD a copy of the Centos 7 installation DVD (64 bit edition) from the Centos web site or the Belmont server.<br>'''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, and any computer you bought in the last few years for yourself will be 64bit as well. | ||
− | #* '''Seneca's mirror of Centos:''' http://belmont.senecacollege.ca/pub/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1511.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.senecacollege.ca/pub/centos/7.2.1511/isos/x86_64/CentOS-7-x86_64-DVD-1511.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 /> |
+ | #* '''Outside Seneca College link (available from any Internet connection):''' http://archive.kernel.org/centos-vault/7.2.1511/isos/x86_64/CentOS-7-x86_64-DVD-1511.iso<br /> | ||
# Insert your removable harddrive into the machine and boot from the DVD. | # Insert your removable harddrive into the machine and boot from the DVD. | ||
{{Admon/tip |Boot order|Some of our machines' boot order is configured to be Harddrive first, DVD second. Which means you won't be able to boot from the DVD if you already have an operating system installed on your drive.}} | {{Admon/tip |Boot order|Some of our machines' boot order is configured to be Harddrive first, DVD second. Which means you won't be able to boot from the DVD if you already have an operating system installed on your drive.}} |
Revision as of 12:57, 7 January 2017
Contents
OBJECTIVE & PREPARATION
This lab is a repeat of a portion of lab1 that you already performed in OPS235 plus some newer content that relates to this week's notes. You are expected to be able to complete all this using your existing skills and knowledge or refer back to your OPS235 lab-book or OPS235 WIKI notes.
In this is lab, you will install your host machine (Centos7), install virtualization software, and create and install 3 virtual machines.
Required materials
- Centos 7 Full Installation DVD.
- One SATA hard disk in a removable drive tray (minimum 250GB). It is strongly advised you dedicate a drive for this course only.
- USB drive (8 GB+) for creating and storing backups (Virtual Machines, configuration files).
- OPS335 Lab Log-book (Previous OPS235 log lab-book as an additional resource).
Online Resources
INVESTIGATION 1: HOST INSTALLATION
Installation instructions for Centos 7
- It may be advisable to obtain a newer version of the Centos 7 Full Installation DVD since there may be improvements since the last version from when you took OPS235.
- Download and burn on a DVD a copy of the Centos 7 installation DVD (64 bit edition) from the Centos web site or the Belmont server.
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, and any computer you bought in the last few years for yourself will be 64bit as well.- Seneca's mirror of Centos: http://belmont.senecacollege.ca/pub/centos/7.2.1511/isos/x86_64/CentOS-7-x86_64-DVD-1511.iso
(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.)
- Outside Seneca College link (available from any Internet connection): http://archive.kernel.org/centos-vault/7.2.1511/isos/x86_64/CentOS-7-x86_64-DVD-1511.iso
- Outside Seneca College link (available from any Internet connection): http://archive.kernel.org/centos-vault/7.2.1511/isos/x86_64/CentOS-7-x86_64-DVD-1511.iso
- Insert your removable harddrive into the machine and boot from the DVD.
- Customize your installation following these guidelines:
- Turn on networking and use host as the hostname.
- Under software selection, choose Gnome desktop.
- The partition setup is similar to what you had in OPS235:
- Delete any old partitions.
- Select the hard disk and indicate "I will configure partitions" and click done.
- Click the link to create partitions automatically (this will give a typical layout with /, /boot, /boot/efi, /home, etc).
- Free up at least 100GB of disk space by shrinking the /home partition (At least 40 GB for root (/) and 40GBGB for /home). Since your machine will have far fewer users and more virtual machines than a typical installation, we will need that space elsewhere.
- Create a new logical volume for /var/lib/libvirt/images and give it the space made available by shrinking /home (You will need enough space for up to 10 virtual machines at 8GB each plus room to compress/extract images).
- Make certain that the existing partitions have the file system type ext4 (not xfs).
- After the installation starts you will also have the opportunity to create users.
- Set the root password
- Create a user account named with your MySeneca ID
First boot
- In the current version of CentOS the first time you boot your system a licence prompt comes up. To save you some stress, here are the keys you need to press to get past it:
- 1 ENTER
- 2 ENTER
- c ENTER
- c ENTER
- Log in and check that you have access to the internet. If you don't - you need to get the network interface to come up on boot. Edit /etc/sysconfig/network-scripts/ifcfg-eno1 (the name of the interface may be different) and change onboot to yes.
- You can then use the ifup/ifdown commands to reset your network configuration or you can just reboot.
- If you professor is Andrew Smith - make sure SELinux is disabled. Otherwise make certain that SELinux is enforcing for security reasons (this should be the default). To make it enforcing, simply edit the /etc/selinux/config file and follow the instructions inside.
- Install all updates using the yum update command.
Using iptables
The most recent variants of Centos and Fedora are using a service called firewalld that is intended to replace iptables, however the iptables service is still in relatively common usage. In this course we will concentrate on iptables.
- Disable firewalld:
systemctl disable firewalld systemctl stop firewalld
- Install and enable the IPTables services:
yum install iptables-services systemctl enable iptables systemctl start iptables
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.
Record steps, commands, and your observations in INVESTIGATION 1 in your OPS335 lab log-book
INVESTIGATION 2: VIRTUAL MACHINE INSTALLATION
Configuring a VM host
- You will need to install some software to allow your machine to act as a host for virtual machines. We'll be using the same libvirt and virt-manager you used in OPS235.
You may find it helpful to refer back to the OPS235 notes to perform the following operations:- Install the required virtualization software
- Start and enable the virtualization service
- Reboot your host machine
- Start the graphical virtual machine manager (virt-manager). Do this as you regular user, and don't run virt-manager from a terminal where you're logged in as root.
- We will be creating our own virtual network. A default virtual network has been created for you, but you will be using a custom one in this course.
- Right click localhost (QEMU) and select Details.
- Click on the Virtual Networks tab.
- Stop and delete the default network.
- 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 (for 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 10 static IP addresses outside it (note: leave the low numbers available for static addresses).
- Choose Forwarding to physical network radio button, Destination: Any physical device and Mode: NAT
- Ensure the network is started at boot.
VM Installation
With the virtualization software installed and your personal network created, you are now ready to create your first virtual machine. First, It is a good idea to make certain that your host machine has been set up correctly prior to creating your first virtual machine:
- Open a separate terminal and issue the ifconfig command on your host machine to know your physical network and your virtual network. Note this information for the next few steps.
- Issue the following command to download the bash shell script depending on your professor:
Andrew Smith: wget http://scs.senecacollege.ca/~andrew.smith/ops335/labcheck_install.sh
All other professors: wget http://matrix.senecac.on.ca/~murray.saul/ops335/labcheck_install.sh - Assign execute permissions, and run the script to check your work:
labcheck_install.sh
- Use the information from the ifconfig command to correctly specify the physical network interface and the virtual network interface.
NOTE: You will need an ISO file for CentOS 7 (the same one you burned your DVD from). It is recommended to use the command:
wget http://belmont.senecacollege.ca/pub/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1511.iso to download this image onto your host machine. In this way, you can keep it on your host machine for the remainder of this course in case you need it.
Perform the following steps to create your first VM on your Virtual Machine Manager application:
- Create a new virtual machine named vm1.
- Accept the default file type (which is qcow). You are NOT required to specify the VM file pathname as you did in OPS235.
- Since you will be installing a Linux server (as opposed to a Gnome Desktop workstation), you can use the default memory and CPU options for use with lab computers.
- Set the disk image size set to 8GB
Note: Since you already setup your virtual network to OPS335, your VM will be automatically connected to your new ops335 virtual network. - Note the following installation steps when you install your created VM:
- Select the correct location / Time Zone.
- For Software Selection: Accept the default minimum install. None of your VMs in this course will have a GUI since GUIs needlessly consume resources and image space.
- Click Installation Destination, and then click Done to confirm that an automatic install will be performed.
- Click Network & Hostname and set hostname to: vm1.localdomain and make certain the Ethernet connection is set to ON.
- 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.
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
ssh your_seneca_id@matrix.senecac.on.ca
- If that did not work - make sure your network interface is started automatically on boot.
- Once you have a working connection - update your machine.
yum update
- Use yum to install the bind-utils package. The commands it provides (e.g. nslookup) will be useful in troubleshooting your network connection.
- Configure the virtual machine to use iptables (instead of firewalld) the same way you did for the host.
- Reboot the virtual machine once it is updated.
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 vm2 and 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 by performing the following steps:
- Make certain that your vm1 virtual machine is shutdown.
- For your vm1 machine, go to the details section and remove the device Channel qemu-ga.
- In the virtual machine manager, right click on vm1 and select Clone....
- Set the Name to be: vm2
- Once successfully created, boot the new VM and correct the host name. This can be done using the hostnamectl command-line tool.
- Record in your notes the steps for cloning a vm.
- Use the host command to check for connectivity
- After creating vm2 repeat the above steps to create vm3 and correct the host name.
Record steps, commands, and your observations in INVESTIGATION 2 in your OPS335 lab log-book
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 minimal installations of Centos 7. Each machine must be fully updated and have access to the network (for example, to get further updates) and be able ping the others. Each machine must be using iptables for the firewall.
Depending on your professor you will either be asked to submit the lab in class, or online. Follow the appropriate set of instructions below
Online Submission
Follow the instructions for lab 0 on moodle.
In Class Submission
Arrange evidence (command output) for each of these items on your screen, then ask your instructor to review them and sign off on the lab's completion:
- ✓ Host Machine installed
- ✓ 3 virtual machines installed
- ✓ Each machine (host and VM) has access to the network
- ✓ Lab logbook completed
- ✓ Run the labcheck_install.sh shell script on your hostmachine to show your professor the results
EXPLORATION QUESTIONS
- What kernel release is your host system running?
- What kernel release are your virtual machines running?
- What is the UUID (Universally Unique Identifier) of your root file system? What command was used to obtain this information?
- What is the size and type of the /boot file system on your host?
- What file was edited to change the host name on your VM's? Are there other ways to change the hostname?