Open main menu

CDOT Wiki β

Changes

OPS245 Lab 1 dev

1,182 bytes added, 22:53, 14 February 2023
no edit summary
=LAB PREPARATION=
[[Image:vmware-1a-rhel.png|thumb|right|450px|The VMware Workstation application will allow you to create and administer '''4 different virtual machines''' ('''VM'''s) on your computer system. ]]
===Purpose of Lab 1===
| |[[Image:ssd.png|thumb|left|175px|<b>Solid State Drive</b><br>Minimum Size: 250GB]]
| [[Image:log-book.png|thumb|left|100px|<b>Lab Logbook</b><br>[[:Media:OPS245-Logbook-Online.doc|(lab 1Click Here to Download)]]]]
| style="padding-left:15px;" |Package Management
| style="padding-left:15px;"|Matrix on-line tutorials<br><ul><li>Linux Basics:<br>'''/home/ops235/linux-basics'''</li><li>Using the vi Text Editor:<br>'''/home/ops235/vi-tutorial'''</li><li>Shell Scripting - Part I (Scripting Basics):<br>'''/home/ops235/scripting-1'''</li></ul>
|}
 
= INVESTIGATION 1: CREATING A RED HAT ACCOUNT AND DOWNLOADING THE ISO =
'''<u>r7host r9host VM Details:</u>'''
*'''Name:''' r9host
|-
|
[[Image:partition_verificationRhel_Partition_verification.png|thumb|right|450px|Carefully verify partition mount-names and sizes prior to proceeding with install. Check [http://matrix.senecac.on.ca/~murray.saul/ops235/installation/ installation screenshots] link for verification.]]
|}
::'''Connect to Red Hat:'''<ul><li>Enter the '''User name''' and '''Password''' for the account you created in '''Investigation 1'''.</li><li>Under '''Purpose''' Check the box that says '''Set System Purpose'''</li><li>For '''Role''' select '''Red Hat Enterprise Linux Server'''</li><li>For '''SLA''' select '''Self-Support'''</li><li>For '''Usage''' select '''Production'''</li><li>Check the box that says '''Connect to Red Hat Insights'''</li><li>Click '''Register'''. This may take a few minutes.</li><li>Click '''Done'''.</li></ul><br>
# Open Terminal.
# Type: <b><code><span style="color:#3366CC;font-size:1.3em;">sudo yum dnf update</span></code></b>
# Follow the prompts.
# If there is a kernel update, reboot your system. (There usually is on a first update after OS installation.)
<tr valign="top">
<td width="20%" style="border-bottom: thin solid black;"><b><code><span style="pointer-events: none;cursor: default;color:#3366CC;font-size:1.2em;">ip address show</span></code></b><br><b><code><span style="pointer-events: none;cursor: default;color:#3366CC;font-size:1.2em;">ip route show</span></code></b><br><b><code><span style="pointer-events: none;cursor: default;color:#3366CC;font-size:1.2em;">nslookup</span> (at prompt, enter command: server. When you are done type exit.) </code></b></td>
<td width="20%" style="border-bottom: thin solid black;">Obtain network connectivity confirmation including: '''IP ADDRESS''', '''Netmask''', '''routing''' (default gateway), and the default '''Domain Name Server'''.</td>
</tr>
<li>View the ''report.txt'' contents. You should be able to understand them because you just put that content there, but what would this look like if you look at the file several months from now? In order to make this file more readable, use the command line to add a blank line between the output from each command, and a header before each command briefly describing what the output is (note that this will likely require re-running all of these commands).</li></ol>
'''Answer Investigation 3 4 observations (all parts and questions) in your lab log book.'''
= INVESTIGATION 5: Using Python Scripting to Generate System Information Reports =
:'''Perform the Following Steps:'''
<ol>
<li>Install Check if python3 is installed on your Centos RHEL Host machine. Open a terminal and type:</li><code style="color:#3366CC;font-family:courier;font-size:.9em;margin-left:20px;font-weight:bold;">which python3</code><li>The output should of the previous command should show python3 is already installed. If it is not, install python3 on your RHEL Host machine.</li>
<code style="color:#3366CC;font-family:courier;font-size:.9em;margin-left:20px;font-weight:bold;">
sudo yum dnf install python3
</code>
<li><ul><li>Create a new file in your '''~/bin''' directory called '''myreport.py'''</li>
<li>Add a line that will print out the heading '''System Report'''<br />
<code style="color:#3366CC;font-family:courier;font-size:.9em;margin-left:20px;font-weight:bold;">
print('System Report\n')
</code>
</li>
<li>Save your script and run it. Does it work?</li>
<li>You'll notice that the python script is currently sending its output to your terminal. Since we haven't covered how to write to a file yet, this is ok for now. Just use output redirection on the command line when you run the script to send the output to '''~/bin/pythonreport.txt'''.</li>
<li>Add Open your script in a text editor (like Vi) again, and add the following lines below the print statement:</li><pre style="color:#3366CC;font-family:courier;font-size:.9em;margin-left:20px;>&#35; Import the Operating System moduleimport os &#35; Print a heading for the date command outputprint('Current Date:') &#35; Call the date command using the os moduleos.system("date +'%A %B %d, %Y (%I:%M %p)'")</pre><li>Save your script and run it again. Observe the output. What do you think the os.system command did?</li><li>Based on the above example and output, add the extra commands for your python script to also output (with appropriate headings):
<ul>
<li>The current date.</li>
<li>The hostname of the machine.</li>
<li>The kernel version.</li>
</ul>
</li>
<li>Run your script to make sure it works. Note that the output does not need to match investigation 3 4 exactly, but it should be very close.</li>
</ol>
Shell scripting is <u>so essential</u> for Linux administration that this course has created a shell script for every lab for this course that a student must download and run in order to check their work.
If you have performed the lab correctly, then you will get a series of <b><code><span style="color:#66cc00;border:thin solid black;font-size:1.2em;">&nbsp;OK&nbsp;</span></code></b> messages and you can proceed with the SIGN-OFF for lab1. On the other hand, if there were errors, then a <b><code><span style="color:#ff0000;border:thin solid black;font-size:1.2em;">&nbsp;WARNING&nbsp;</span></code></b> message will appear with general suggestions that you will need to fix on your c7hostVM r9hostVM in order to have your professor sign-off in this lab in order to proceed to the next lab.
:'''Perform the Following Steps:'''
# Make certain that your '''c7hostr9host''' VM is running, open the Bash Shell terminal.<br><br># Change to the '''~/bin''' directory.# Install git by issuing the following command: <code>sudo dnf -y install git</code># Download all the lab check scripts into your bin directory: <brcode>git clone https://github.com/ops245/labs/ /home/your-seneca-id/bin<br/code><!-- #Download the checking script by issuing the following Linux command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">wget https://raw.githubusercontent.com/OPS245/labs/main/lab1-check.bash</span></code></b><br><!--For Andrew's sections use this script instead:<br><b><code><span style="color:#3366CC;font-size:1.2em;">wget http://littlesvr.ca/ops245/lab1-check-andrew.bash</span></code></b><br>--><br># Give that downloaded shell script file execute permissions (for the file owner).<br><br># Run the shell script using '''sudo''' and if there are any warnings, make fixes and re-run shell script until you receive a "congratulations" message.: <brcode>sudo ./lab1-check.bash<br/code>#Arrange evidence (command output) for each of these items on your screen:
::<span style="color:green;font-size:1.5em;">&#x2713;</span> Run the '''lab1-check.bash''' script (must have all <span style="color:#66cc00;border:thin solid black;font-size:1.2em;">&nbsp;OK&nbsp;</span> messages, and the congratulations message)
::<span style="color:green;font-size:1.5em;">&#x2713;</span> Proof that c7host r9host VM is set for '''virtualization''' (Refer to: '''INVESTIGATION 12''' - '''Part 1''' - '''Step #29''')
: 78. Take a screenshot of the evidence and upload it, the file generated by the lab1-check.bash script, your logbook, and your myreport.py to blackboard.
= Practice For Quizzes, Tests, Midterm &amp; Final Exam =
# Define the term Virtual Machine.
# List the major screens (steps) in the installation of CentOS 7 Red Hat Enterprise Linux 9 full install DVD.
# What key-combination is used to toggle the view of your running VM from "window-mode" to "full-screen-mode"?
# List the steps for setting SELinux to permissive mode.