Difference between revisions of "OSL840 Installation Lab"

From CDOT Wiki
Jump to: navigation, search
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:OSL840]][[Category:OSL840 Labs]]
+
'''OSL840 Prep Lab'''
  
== OBJECTIVE & PREPARATION ==
+
'''Objective & Preparation'''
  
This lab is a repeat of a portion of lab1 (and some of lab2) that you already performed in OSL740 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 OSL740 lab-book or OSL740 WIKI notes.
+
You will derive the most from your learning in this course through attending lectures, doing the labs and assignments in person. You will not get as much learning by simply doing the labs without understanding what you are doing. Prep lab requires students to complete installation of Linux workstation. You are expected to utilize the skills and knowledge acquired in OSL740 to complete this lab. You will need your workstation to connect to AWS cloud-based virtual machines (AWS refers to them as instances).
  
In this is lab, you will install your '''host machine''' (Centos7), '''install virtualization software''', and '''create and install 3 nested virtual machines'''.
+
Knowledge and skills will be required from foundation courses in the OPS stream namely OSL640 and OSL740.  
  
=== Required materials ===
+
Using the Linux workstation, you will use terminal window to connect to instances, edit files, navigate in Linux filesystems, add and manage users, manage LVM storage devices and services using systemctl, locate, read and monitor log files, write basic shell scripts, know simple iptables configurations.
*Centos 7 Full Installation DVD.
 
*One Solid State Drive (SSD), mininmum capacity: 240 GB (USB 3.0). It is strongly advised you dedicate a drive for this course only.
 
  
=== Online Resources===
+
All labs and assignments must be completed on AWS interface and by connecting to the instances.
  
*[https://wiki.centos.org/TipsAndTricks#head-4c9ee55a5c9dc051bd32e795b46a3856e41a0335 Centos7 Install Tips]
+
Your instructor will setup an AWS account for you. Once the account is setup, you will receive an email from AWS and be provided with $100 credit to complete all labs and assignments for this course. These credits are more than enough and is your responsibility to manage this. This limit cannot be increased by AWS or your instructor. Credits will get used much faster if you are careless with how you use the cloud-based AWS instances.
<br>
 
  
==INVESTIGATION 1: HOST INSTALLATION==
 
  
=== Installation instructions for CentOS 7 ===
+
== Workstation setup ==
# 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 OSL740.<br><br>
 
# 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 equipped with Intel 64 bit mainboards and CPUs, and any computer you bought in the last few years for yourself will be 64bit as well.<br><br>
 
#* '''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  - you can't access this from home. You can burn this disc on the machines in the Open Lab.)<br><br>
 
#* '''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 need to refer to your OSL740 notes in order to install your host machine.<br>Here is a direct link:<br> [https://wiki.cdot.senecacollege.ca/wiki/OSL740_Lab_1 OSL740 - Lab1] 
 
<ol>
 
<li value=4>Customize your installation following these guidelines:
 
<ul>
 
<li>'''Turn on networking''' and use '''host''' as the '''hostname'''.
 
<li>Under software selection, choose '''Gnome desktop'''.
 
<li>The partition setup is similar to what you had in OSL740:
 
<ul>
 
<li>Delete any old partitions.
 
<li>Select the hard disk and indicate "I will configure partitions" and click done.
 
<li>Click the link to '''create them (partitions) automatically''' (this will give a typical layout with /, /boot, /boot/efi, /home, etc).
 
<li>Free up at least '''100GB''' of disk space by shrinking the '''/home''' partition (At least '''40 GB''' for root (/) and '''40GB''' for /home).  Since your machine will have far fewer users and more virtual machines than a typical installation, we will need that space elsewhere.
 
<li>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).
 
<li>Make certain that the existing partitions '''except swap, /boot and /boot/efi''' have the file system type '''ext4''' (not xfs).
 
</ul>
 
</ul>
 
<li>After the installation starts you will also have the opportunity to create users.
 
<ul>
 
<li>Set the root password
 
<li>Create a '''user account''' named with '''your MySeneca ID'''
 
</ul>
 
</ol>
 
<br>
 
  
=== First boot ===
+
Use VMWare Workstation Pro to setup your Linux workstation on 240GB SSD drive.
 +
        Do not use previously configured Linux workstation or nested VMs from earlier course(s).
 +
Setup your workstation using Centos 7 or Linux Mint and name your workstation senecauserid_c7host. Do not configure nested virtual machines environment as in OSL740. You will waste unnecessary time if you configure nested virtual machines. Make sure you create a regular user with your senecausername once installation is complete.
 +
 +
 +
        CentOS 7 download: https://mirror.netflash.net/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-DVD-2009.iso
 +
        Linux Mint download: https://www.linuxmint.com/download.php
  
# In the current version of CentOS the first time you boot your system a graphical licence prompt comes up.<br><br>
+
Refer to OSL740 lab 1 if you need help setting up your workstation. https://wiki.cdot.senecacollege.ca/wiki/OSL740_Lab_1
<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 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 network configuration 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.
+
 
+
'''Submission Requirements:'''
{{Admon/important |SELinux|- 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.}}
+
  Your instructor will check your workstation is installed.
</li><li>Install all updates using the '''yum update''' command.</li></ol>
+
  There is no submission for this lab on Blackboard.
<br>
 
 
 
===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''.
 
<ol><li>Disable firewalld:
 
<source>
 
systemctl disable firewalld
 
systemctl stop firewalld
 
</source>
 
</ol>
 
<ol><li value="2">Install and enable the IPTables services:
 
<source>
 
yum install iptables-services
 
systemctl enable iptables
 
systemctl 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 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 OSL840 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 [https://wiki.cdot.senecacollege.ca/wiki/OSL740_Lab_2 OSL740 - Lab2].<br>You may find it helpful to refer back to the '''OSL740 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-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 <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 following options:
 
#:* Name your virtual network '''osl840'''
 
#:* 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</b>, the network address would be 192.168.<b>90</b>.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'''.
 
 
 
<br>
 
 
 
=== 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 '''ip address show''' 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 Bash shell script to check your host machine's set-up prior to proceeding with this lab:<br>'''wget http://ict.senecacollege.ca/~azzad.kara/osl840/labcheck_install.sh'''<br>
 
#Assign execute permissions, and run the script to check your work:<br>
 
'''labcheck_install.sh'''
 
<ol><li value="4">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). It is recommended to use the command 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:
 
 
 
'''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'''.
 
# Accept the default file type (which is '''qcow2'''). You are <u>NOT</u> required to specify the VM file pathname as you did in OSL740.
 
 
 
 
 
{{Admon/tip|VM File Types ( '''.qcow2''' vs '''.img''' )|In OSL740, you selected the VM images as a '''"raw"''' image. In OSL840, you will be accepting the default image file '''".qcow2"''' (which stands for "QMENU Copy on Write version 2" ) that provides more features when manipulating stored VM images.}}
 
 
 
 
 
<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'''.</li><li>Set the disk image size set to '''8GB'''<br><br>Note: Since you already setup your virtual network to OSL840, your VM will be automatically connected to your new ols840 virtual network.<br><br></li><li>Note the following installation steps when you install your created VM:</li></ol>
 
 
 
::* 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. <ol><li>Click '''Installation Destination''', and then click '''Done''' to confirm that an '''automatic install''' will be performed.</li><li>Click  Network & Hostname and set hostname to: '''vm1.localdomain''' and make certain the ''Ethernet connection'' is set to '''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>
 
 
 
{{Admon/tip|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 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.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, ensure 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'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.</li></ol>
 
  '''yum update'''
 
<ol>
 
<li value="5">Install the '''bind-utils''' package.  The commands it provides (e.g. nslookup) will be useful in troubleshooting your network connection.</li>
 
<li>You may also want to install the '''nmap''', '''telnet''' and '''net-tools''' packages to help you troubleshoot connectivity issues.</li>
 
<li>Configure '''firewalld, iptables''' and (if required) '''SELinux''' the same way you did for the host.</li>
 
<li>Reboot the 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 previous steps, repeat them to create two more virtual machines.</li>
 
<li>'''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:'''</li>
 
<li><ol type="a">
 
<li>Make certain that your '''vm1''' virtual machine is shutdown.</li>
 
<li>For your '''vm1''' machine, go to the details section and remove the <u>device</u> '''Channel qemu-ga'''.</li>
 
<li>In the virtual machine manager, '''right click''' on ''vm1'' and select '''Clone...'''.</li>
 
<li>Set the Name to be: '''vm2'''</li>
 
</ol></li>
 
<li>Once successfully created, boot the new VM and correct the host name. This can be done using the '''hostnamectl''' command-line tool.</li>
 
<li>Record in your notes the steps for cloning a vm.</li>
 
<li>Use the host command to check for connectivity</li>
 
<li>After creating '''vm2''' repeat the above steps to create '''vm3''' and correct the hostname ('''vm2.localdomain''' and '''vm3.localdomain''' respectively).</li>
 
</ol>
 
 
 
{{Admon/important |Backup your VMs!|You MUST backup ALL of your VMs whenever you complete your '''OSL840 labs''' or when working on your '''OSL840 assignments.'''You should backup your VMs to a USB key in case something happens to your host machine. Note: VM files contained in the '''/var/lib/libvirt/images''' directory have the extension in '''.qcow2''' and instead of '''.img'''}}
 
 
 
 
 
'''Record steps, commands, and your observations in INVESTIGATION 2 in your OSL840 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.
 
 
 
===Online Submission===
 
 
 
Follow the instructions for lab 0 on blackboard.
 
 
 
<!--
 
===Andrew's sections===
 
 
 
You may choose to:
 
* Submit screenshots of your work on Blackboard, in which case you don't need to come to the lab.
 
* Or come to the lab, show me your work, and talk to me about it. I want to hear what you've learned and answer any questions you have.
 
 
 
You'll get the same grade regardless of how you choose to submit your work.
 
 
 
Expected results of this lab are:
 
 
 
::<span style="color:green;font-size:1.5em;">&#x2713;</span> Host Machine installed
 
::<span style="color:green;font-size:1.5em;">&#x2713;</span> 3 virtual machines installed
 
::<span style="color:green;font-size:1.5em;">&#x2713;</span> Each machine (host and VM) has access to the network
 
::<span style="color:green;font-size:1.5em;">&#x2713;</span> Lab logbook completed
 
::<span style="color:green;font-size:1.5em;">&#x2713;</span> Run the '''labcheck_install.sh''' shell script on your host machine
 
-->
 
 
 
==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?
 

Latest revision as of 15:56, 3 August 2023

OSL840 Prep Lab

Objective & Preparation

You will derive the most from your learning in this course through attending lectures, doing the labs and assignments in person. You will not get as much learning by simply doing the labs without understanding what you are doing. Prep lab requires students to complete installation of Linux workstation. You are expected to utilize the skills and knowledge acquired in OSL740 to complete this lab. You will need your workstation to connect to AWS cloud-based virtual machines (AWS refers to them as instances).

Knowledge and skills will be required from foundation courses in the OPS stream namely OSL640 and OSL740.

Using the Linux workstation, you will use terminal window to connect to instances, edit files, navigate in Linux filesystems, add and manage users, manage LVM storage devices and services using systemctl, locate, read and monitor log files, write basic shell scripts, know simple iptables configurations.

All labs and assignments must be completed on AWS interface and by connecting to the instances.

Your instructor will setup an AWS account for you. Once the account is setup, you will receive an email from AWS and be provided with $100 credit to complete all labs and assignments for this course. These credits are more than enough and is your responsibility to manage this. This limit cannot be increased by AWS or your instructor. Credits will get used much faster if you are careless with how you use the cloud-based AWS instances.


Workstation setup

Use VMWare Workstation Pro to setup your Linux workstation on 240GB SSD drive.

       Do not use previously configured Linux workstation or nested VMs from earlier course(s).

Setup your workstation using Centos 7 or Linux Mint and name your workstation senecauserid_c7host. Do not configure nested virtual machines environment as in OSL740. You will waste unnecessary time if you configure nested virtual machines. Make sure you create a regular user with your senecausername once installation is complete.


       CentOS 7 download: https://mirror.netflash.net/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-DVD-2009.iso
       Linux Mint download: https://www.linuxmint.com/download.php

Refer to OSL740 lab 1 if you need help setting up your workstation. https://wiki.cdot.senecacollege.ca/wiki/OSL740_Lab_1

Submission Requirements: Your instructor will check your workstation is installed. There is no submission for this lab on Blackboard.