Changes

Jump to: navigation, search

OPS335 Installation Lab

4,613 bytes added, 12:50, 11 August 2022
no edit summary
[[Category:OPS335]][[Category:OPS335 Labs]]
== Objectives OBJECTIVE & PREPARATION ==*Install your host machine (Centos 6.5)*Install 3 virtual machines (VMs) (Fedora 20)*Prepare for lab exercises.
== Required materials ==*Centos 6.5 Installation DVD*One SATA hard disk in This lab is a repeat of a removable drive tray portion of lab1 (minimum 160GBand some of lab2) - It is strongly advised that you dedicate a drive for already performed in OPS235 plus some newer content that relates to this course onlyweek's notes.*Recommended You are expected to be able to complete all this using your existing skills and knowledge or refer back to your OPS235 lab- USB drive (8 GB+) for creating and storing backups (Virtual Machines, configuration files)book or OPS235 WIKI notes.
==Part A: Host Installation ==In this is lab, you will install your '''host machine''' (Centos7), '''install virtualization software''', and '''create and install 3 nested virtual machines'''.
=== Installation instructions for Centos 6.5 Required materials ===#Download a copy of the *Centos 6.5 installation DVD (64 bit edition) from the Centos web site or burn the 7 Full Installation 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.#* '''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 />One Solid State Drive (This is very fastSSD), 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 listmininmum capacity:''' http://isoredirect.centos.org/centos/6/isos/x86_64/<br />240 GB (Accessible from any Internet connectionUSB 3.0)<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. #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 It is strongly advised you dedicate 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 drive 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#After completing the installation, remove the DVD and reboot from your HDDonly.
{{Admon/tip|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. }}=== Online Resources===
=== Booting your system ===#create a user named with your learn ID#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*[https:#*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.#*Run and record the output of the 'df -hT' command.#*Run and record the output of the 'cat /etc/fstab' commandwiki.centos.#*Run and record the output of the 'cat /etcorg/issue' command.TipsAndTricks#*Run and record the output of the 'uname head-a' command.4c9ee55a5c9dc051bd32e795b46a3856e41a0335 Centos7 Install Tips]<br>
==INVESTIGATION 1: HOST INSTALLATION=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.
*You will need to install some software to allow your machine to act as a host === Installation instructions for virtual machinesCentOS 7 === yum groupinstall virtualization# It may be advisable to obtain the <u>latest version</u> of the CentOS 7 Full Installation DVD since there may be improvements since the last version from when you took OPS235.<br><br> yum install virt-manager libvirt*Start # Download and enable the virtualization service service libvirtd start chkconfig libvirtd burn on*Note that when starting libvirtd you may receive a warning DVD a copy of the CentOS 7 installation DVD (64 bit edition) from the CentOS web site or the Belmont server.<br>'''virGetHostnameNote: getaddrinfo failed ''' we'll be using the 64 bit version of CentOS because all of our lab computers are equipped with Intel 64 bit mainboards and CPUs, and any computer you bought in the last few years for "Machine Name": Name or service not known. This yourself will not interfere with your machinesbe 64bit as well.<br><br>#*Reboot your machine'''Seneca's mirror of CentOS:''' https://mirror.senecacollege.ca/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-2009. iso <br>This is very fast, but is only accessible from within Seneca's network If - you do not, you will not be able to install any virtual can't access this from home. You can burn this disc on the machinesin the Open Lab.)<br><br>#*Start the graphical virtual machine manager'''Outside Seneca College link (available from any Internet connection):<br>''' https://mirror.netflash.net/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-DVD-2009.iso<br /><br>**# You will need to enter refer to your root passwordOPS235 notes in order to install your host machine.<br>Here is a direct link:<br> [https://wiki.cdot.senecacollege.ca/wiki/OPS245_Lab_1 OPS245 - Lab1] *Create <ol><li value=4>Customize your own virtual networkinstallation following these guidelines:<ul><li>'''Turn on networking''' and use '''host''' as the '''hostname'''.**A default one has been created for you<li>Under software selection, but choose '''Gnome desktop'''.<li>The partition setup is similar to what you will be using a custom one had in this courseOPS235:<ul><li>Delete any old partitions.#Right <li>Select the hard disk and indicate "I will configure partitions" and click done.<li>Click the link to '''localhost create them (QEMUpartitions)automatically' and select 'Details'(this will give a typical layout with /, /boot, /boot/efi, /home, etc). Click on <li>Free up at least '''100GB''' of disk space by shrinking the 'Virtual Networks' tab.#Stop '/home''' partition (At least '''40 GB''' for root (/) and delete the 'default' network'40GB''' for /home).#Run Since your machine will have far fewer users and more virtual machines than a typical installation, and record the output of the following command: iptables -t nat -Lwe will need that space elsewhere.#Use the plus sign to add <li>Create a new virtual network using the following options.#*Name your virtual network logical volume for '''/var/lib/libvirt/images''ops335'#*Use and give it the last two digits of your student number space made available by shrinking /home (You will need enough space for the third octet of network IP addressup to 10 virtual machines at 8GB each plus room to compress/extract images). Example, if your student number is 000-000-0<bli>90<Make certain that the existing partitions '''except swap, /boot and /boot/b>, efi''' have the network address would be 192.168file system type '''ext4''' (not xfs).<b/ul>90</bul>.0/24.#*Ensure <li>After the DHCP range installation starts you will allow you also have the opportunity to assign at least 3 static IP addresses outside itcreate users.#*Choose <ul><li>Set the root password<li>Create a '''user account''' named with 'Forwarding to physical network' radio button, 'Destination: Any physical deviceyour MySeneca ID' and 'Mode: NAT'#*Ensure the network is started at boot.</ul>#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):</ol> iptables -t nat -L<br>
==Part B: Virtual Machine Installation = First boot ===With # In the current version of CentOS the first time you boot your system a graphical licence prompt comes up.<br><br><ol><li value="2">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 the virtualization software installed appropriate config file and configure your main network interface to come up at boot.<ul><li>You can then use the '''ifup'''/'''ifdown''' commands to reset your personal network createdconfiguration or you can just reboot.</li></ul></li><li>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. {{Admon/important |SELinux in Andrew's sections|If you 're in one of Andrew's sections - please disable SELinux (i.e. do the opposite of the bullet above). This will give you some extra freedom in the rest of the course to learn and experiment without being bogged down by inexplicable permission denied errors.}}</li><li>Install all updates using the '''yum update''' command.</li></ol><br> ===Using iptables===The most recent variants of Centos and Fedora are now ready using a service called '''firewalld''' that is intended to create your first replace '''iptables''', however the ''iptables'' service is still in relatively common usage. In this course we will concentrate on ''iptables''.<ol><li>Disable firewalld:<source>systemctl disable firewalldsystemctl stop firewalld</source></ol><ol><li value="2">Install and enable the IPTables services:<source>yum install iptables-servicessystemctl enable iptablessystemctl start iptables</source></ol>At this point you have a basic Centos system installed and updated. This will serve as a host for the virtual machinemachines 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 installation DVD emergency for Fedora you can use thatanyone else. '''Record steps, commands, but it and your observations in INVESTIGATION 1 in your OPS235 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 much faster to download using the iso from belmont same '''libvirt''' and install directly from it. wget http'''virt-manager''' you used in [https://belmontwiki.senecaccdot.onsenecacollege.ca/fedorawiki/releases/20/Fedora/x86_64/iso/FedoraOPS235_Lab_2 OPS235 -20Lab2].<br>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<br><br># Start the graphical virtual machine manager (''virt-x86_64manager''). Do this as you regular user, and don't run virt-DVDmanager from a terminal where you're logged in as root.iso If it # We will be creating our own virtual network. A default virtual network has not been made available use created for you, but you will be using a <u>custom</u> 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 publicly available mirrorsfollowing options:#:* Name your virtual network '''ops235''' http#:* 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-0<b>90<//mirrorsb>, the network address would be 192.fedoraproject168.org<b>90</publiclist/Fedora/20b>.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'''#CA:* Ensure the network is '''started at boot'''. <br> ===VM Installation===*Click on With the icon "Create virtualization software installed and your personal network created, you are now ready to create your first virtual machine.First, It is a new 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 '''ip address show''' command on your host machine to beginknow your physical network and your virtual network. Note this information for the next few steps.*Name #Issue the following command to download Bash shell script to check your host machine "f20's set-vm1" up prior to proceeding with this lab:<br>'''wget http://ict.senecacollege.ca/~andrew.smith/ops335/labcheck_install.sh'''<br>#Assign execute permissions, and choose run the script to check your installation method - work:<br> '''labcheck_install.sh'''<ol><li value="Local install media4">Use the information from the '''ip address show''' command to correctly specify the '''physical network interface''' and the '''virtual network interface'''.</li></ol> '''NOTE:''' You will need an ISO file for CentOS 7 (the same one you burned your DVD from). Choose It is recommended to use the desired option command to install from either download this image onto your host machine. In this way, you can keep it on your host machine for the CD or remainder of this course in case you need it: '''wget http://mirror.csclub.uwaterloo.ca/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-2009.iso''' Perform the following steps to create your first VM on your Virtual Machine Manager application: # Create a new virtual machine named '''vm1'''. For # Accept the default file type (which is '''qcow2'''). You are <u>NOT</u> required to specify the VM file pathname as you did in OPS235.  {{Admon/tip|VM File Types ( '''.qcow2''' vs '''.img''' )|In OPS235, you selected the VM images as a '''"OS typeraw" select ''' image. In OPS335, you will be accepting the default image file '''"Linux.qcow2" and ''' (which stands for Version select "Fedora 18 or later" then click QMENU Copy on the Write version 2"Forward" button) that provides more features when manipulating stored VM images.}}  *Use <ol><li value="3">Since you will be installing a Linux <u>server</u> (as opposed to a Gnome Desktop workstation), you can '''use the <u>default </u> 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 </li><li>Set the disk image size set at to '''8GB'''<br><br>Note: Since you already setup your virtual network to OPS335, ensure "Allocate entire disk now" is checked, then click on your VM will be automatically connected to your new ops335 virtual network.<br><br></li><li>Note the "Forward" button.following installation steps when you install your created VM:</li></ol> ::*At Select the "Ready to begin installation" window click on correct ''location / Time Zone'Advanced options' arrow to review available options.::**Select For Software Selection: Accept the Virtual Network named default '''minimum install''ops335'. Make note None of any other available options (you your VMs in this course will need them again in the assignments)have a GUI since GUIs needlessly consume resources and image space.*Select <ol><li>Click '''Installation Destination''', and then click '''Done'''Install to Hard Driveconfirm that an '''automatic install'' ' will be performed.</li><li>Click Network & Hostname and set hostname to begin your Fedora installation: '''vm1. Select localdomain''' and make certain the appropriate default options (You may wish ''Ethernet connection'' is set to review your OPS235 notes to remind yourself what these are)'''ON'''.*</li><li>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.</li></ol>*Set your hostname to "vm1.localdomain".{{Admon/importanttip|Firstboot - First user created|For successful completion of the labs, please ensure the first user created is named using your Seneca username.}} <br>
===First Boot===
*#You may will notice that graphical windows are not being displayed properlythe server installation defaults to a command-line interface. The following steps This is normal, and we will resolve only be using this interface during thiscourse.**At #Ensure your machine has a network connection by running the first opportunitycommand '''ssh your_seneca_id@matrix.senecacollege.ca'''<ol><li value="3">If that did not work - make sure GlobalProtect VPN is installed on your Windows/Mac and connected. If it is, shut the VM downensure your CentOS network interface is started automatically on boot.</li></ol>{{Admon/tip|Default for network config for onboot|If you've turned on your networking interface during installation - it will be turned on by default. If you perform these steps while 've left the network interface off during the installation - it will be off by default.}}<ol><li value="4">Once you have a working connection - update your machine is running .</li></ol> '''yum update'''<ol><li value="5">Install the '''bind-utils''' package. The commands it will claim they provides (e.g. nslookup) will be applied useful in troubleshooting your network connection.</li><li>You may also want to install the next time the machine boots'''nmap''', but that does not work'''telnet''' and '''net-tools''' packages to help you troubleshoot connectivity issues.</li>**While the VM is off<li>Configure '''firewalld, click on iptables''View' and (from if required) '''SELinux''' the same way you did for the menu at host.</li><li>Reboot the top of virtual machine once it is updated.</li></ol> ===Cloning a Virtual Machine===<ol><li> Now that you have one virtual machine working, you will create two more. If you struggled with the VM window)previous steps, repeat them to create two more virtual machines.</li><li>'''If you are confident with what you have done so far, and select you may clone your existing machine to create the others by performing the following steps:'''</li><li><ol type="a"> <li>Make certain that your '''vm1''Details'virtual machine is shutdown.</li>**From <li>For your '''vm1''' machine, go to the menu on details section and remove the left side, select <u>device</u> '''Channel qemu-ga''Video'.</li>**Change <li>In the drop-down list for Model from virtual machine manager, '''right click''' on 'Cirrus' to vm1'vga', and click applyselect '''Clone...'''.</li>**Switch <li>Set the view back Name to be: '''vm2''Console' </li></ol></li><li>Once successfully created, boot the new VM and start correct the host name. This can be done using the machine again'''hostnamectl''' command-line tool.</li>*Ensure <li>Record in your machine has notes the steps for cloning a network connection by running vm.</li><li>Use the host commandto check for connectivity</li> host cbc<li>After creating '''vm2''' repeat the above steps to create '''vm3''' and correct the hostname ('''vm2.localdomain''' and '''vm3.localdomain''' respectively).ca</li></ol> If that did not work, edit the line in {{Admon/important |Backup your VMs!|You MUST backup ALL of your VMs whenever you complete your '''OPS335 labs''' or when working on your '''OPS335 assignments''':<br>[ [https://etcwiki.cdot.senecacollege.ca/sysconfigwiki/networkOPS235_Lab_2_-scripts/ifcfg_CentOS7_-eth0 onboot=no_HD2#Part_1:_Backing_Up_Virtual_Machines Backing up Your Virtual Machines] ]. Refer to OPS235 lab2 notes on how to backup your VMs. You should be onboot=yes*If you had backup your VMs to a USB key in case something happens to change that, reboot your host machine.Note: VM files contained in the '''/var/lib/libvirt/images''' directory have the extension in '''.qcow2''' and instead of '''.img''' (eg. for OPS235 courses prior to Fall 2016.}}
*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
'''Record steps, commands, and your observations in INVESTIGATION 2 in your OPS335 lab log-book''' ===Cloning a Virtual Machine=COMPLETING THE LAB ==*Now that Upon completion of this lab you should have one 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 working, you will create two more. If you struggled with must be fully updated and have access to the previous stepsnetwork (for example, repeat them to create two more virtual machines (naming them f20-vm2 get further updates) and f20-vm3, with hostnames vm2be able ping the others.localdomain and vm3 Each machine must be using iptables for the firewall.localdomain respectively) ===Online Submission=== Follow the instructions for lab 0 on blackboard<!--===Andrew's sections=== You may choose to:*If you are confident with what you have done so farSubmit screenshots of your work on Blackboard, in which case you may clone your existing machine don't need to come to create the otherslab.**To quickly create additional VM's shutdown 'f20-vm1'Or come to the lab, show me your work, right click and select talk to me about it. I want to hear what you'Clone..ve learned and answer any questions you haveYou'll get the same grade regardless of how you choose to submit your work. Use the following options Expected results of this lab are:*Name::<span style="color: f20green;font-vm2size:1.5em;">&#x2713;</span> Host Machine installed*Storage::<span style="color:green;font-size:1.5em;">&#x2713;</span> 3 virtual machines installed**Click the drop down menu below 'f20::<span style="color:green;font-vm1size:1.img', choose details 5em;">&#x2713;</span> Each machine (host and rename the image VM) has access to the f20network::<span style="color:green;font-vm2size:1.img5em;">&#x2713;</span> Lab logbook completed**Once successfully created boot the new VM and correct the host name::<span style="color:green;font-size:1. This can be done using 5em;">&#x2713;</span> Run the GUI or command line'''labcheck_install. **Record in sh''' shell script on your notes how each is done.**Use the host command to check for connectivitymachine**After creating f20-vm2 repeat the above steps to create f20-vm3 and correct the host name.>
== Completing the Lab EXPLORATION QUESTIONS==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 20. Make sure that each machine can access the network (for example, to get updates) and can ping each other.
Exploration questions:
#What is the code name of your installed Fedora Linux system? How did you determine this?
#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?#How are ping and ssh affected (on both machines) when you run Are there other ways to change the following command on the host machinehostname?#*echo 0 > /proc/sys/net/ipv4/ip_forward
163
edits

Navigation menu