Changes

Jump to: navigation, search

OPS245 Lab 3 dev

1 byte added, 17:22, 6 February 2023
no edit summary
<u>Main Objectives</u>
*Learn to boot your CentOS RHEL VM into '''Single User mode''' for rescue purposes
*Create and extract '''archive''' files ('''tar''' and '''tar.gz''')
*Install applications using various methods:
'''A few common problems are:'''
*I Can't boot into Graphical Mode on my '''c7hostr9host''' machine
*I Forgot My '''Regular User''' Password
*I Forgot My '''root''' Password
#Launch the VMware application.
#Select Open Virtual Machine, and select the VM called c7host r9host on your Solid State Drive.#Launch your '''c7hostr9host''' machine, and login as as a regular user.#Boot-up your '''centos1rhel1''' VM. ''' When the Grub Boot menu appears''', press the letter <b><code><span style="color:#3366CC;font-size:1.2em;">e</span></code></b> (for "edit").
#Using your arrow keys, scroll to next screen to '''linux''', or '''linux16''', or '''linux-efi''' command and type the word <b><code><span style="color:#3366CC;font-size:1.2em;">single</span></code></b> as an argument after '''quiet''' (see diagram for reference) and then press <b><code><span style="color:#3366CC;font-size:1.2em;">ctrl-x</span></code></b> to boot.
#The system should boot into text-based mode. Enter your '''root''' password.
#The procedure to reset root's password is different than shown above.
#Make certain that your centos1 rhel1 VM that you used in Part 2 has been shutdown.#Start your centos1 rhel1 VM and press <b><code><span style="color:#3366CC;font-size:1.2em;">e</span></code></b> at the Grub boot menu.
#Using your arrow keys, move to '''linux''' or '''linux-efi''' command and replace the argument '''ro''' with the argument <b><code><span style="color:#3366CC;font-size:1.2em;">rw init=/sysroot/bin/sh</span></code></b> (see diagram for reference) and then press <b><code><span style="color:#3366CC;font-size:1.2em;">ctrl-x</span></code></b> to boot.
#The system should boot into text-based mode without prompting for root's password.
===Catastrophic Boot Problems===
:Not being able to start your '''c7hostr9host''' due to '''Kernel Panic''' or some sort of '''catastrophic disk failure''' is not as easy to fix. You might be able to boot from your a '''Centos LIVE DVD, open a terminal and mount the partition''' via command line and look for possible problems (setup files like '''/etc/fstab'''). '''Lab5''' will discuss more about mounting and the /etc/fstab file. The "worst-case scenario" would be to purchase a new hard disk, '''perform lab1 completely, perform lab2 to install and set-up virtualization software''', then '''restore your VM image and xml file backups''' (eg. decompressing images, issuing virsh define commands for .xml files). That is why consistently '''performing backups of ALL of your VMS at the end of each lab is absolutely essential! You have been warned!'''
'''Answer INVESTIGATION 1 observations / questions in your lab log book.'''
'''Perform the following steps:'''
#Boot up your '''centos3rhel3''' VM.
#Change your working directory to '''/usr/share/doc/sudo*'''
#Use the tar (tape archiver) command to create an archive file named "/tmp/archive1.tar" by issuing the following command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">tar cvf /tmp/archive1.tar .</span></code></b>
'''Perform the following steps:'''
#Remain in your '''centos3rhel3''' VM.
#Create the directory '''/tmp/extract1'''
#Change to the '''/tmp/extract1''' directory.
{| width="40%" align="right" cellpadding="10"
|- valign="top"
|colspan="2"|{{Admon/note|Internet Connection|In order for the '''yum dnf install''' command to work you require a connection to the Internet.}}
|}
=== Part 1: Managing Software and Repositories with Yum DNF ===We will learn how to install software packages with the '''yumdnf''' utility. This command is useful for installing software since it automatically resolves software dependencies prior to installing the software. Upon your Centos RHEL OS installand registration, a link to a software repository is automatically made to allow for easy software updates.
Unfortunately, there is no guarantee that a particular software package is contained on the default repository. In order to overcome this problem, you can add other repositories that may contain the application that you wish to install.
'''Perform the following steps:'''
#Make certain that you are in your '''c7hostr9host''' machine.#Issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">sudo yum dnf install elinks</span></code></b>#Now issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">yum dnf info elinks</span></code></b>
#How can you tell if the elinks package has been installed?
#To remove the elinks package issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">sudo yum dnf remove elinks</span></code></b>
# Verify that the elinks package has been removed. Also verify that the application called: '''xchat''' is not installed.
# Use the wget command to download the xchat rpm binary from the following URL:
::<b><code><span style="color:#3366CC;font-size:1.2em;">http://mirror.centos.org/centos/7/os/x86_64/Packages/xchat-2.8.8-25.el7.x86_64.rpm</span></code></b><br>
::What do you think is the purpose of the numbers also contained in the filename?
<ol><li value="8">Issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">sudo yum dnf localinstall xchat-2.8.8-25.el7.x86_64.rpm</span></code></b></li>
<li>Verify that the '''xchat''' command has been installed.</li>
<li>Run the xchat application.</li></ol>
<ol>
<li value="11">We will now look at how we can add different repositories to our '''c7hostr9host''' machine.</li><li>Issue the following command: <b><code><span style="color:#3366CC;font-size:1.3em;">yum dnf repolist</span></code></b></li><li>Take a few moments to review the output. Do you see which repositories are used by the '''yumdnf''' command? Write down the repositories in your lab logbook.</li><li>View the following link to see a general listing of repositories:<br>[ [http://wiki.centos.org/AdditionalResources/Repositories Available Repositories for Centos] ].</li><li>To add the epel repository, issue the command:<br><b><code><span style="color:#3366CC;font-size:1.3em;">sudo yum dnf install epel-release</span></code></b></li><li>To verify that you have added the repository, you can issue the command: <b><code><span style="color:#3366CC;font-size:1.3em;">yum dnf repolist</span></code></b></li><li>Unused and unneeded software can present a security risk and ties up disk space needlessly. Find '''at least 4 other packages''' to remove on your c7host r9host machine(for example: '''sound & video''', '''games''', etc) that you're not using on your system. '''Be careful ''' to ensure that removing those packages does not also remove other software that you do need.</li>
</ol>
===Part 2: Compiling Source Code from a Downloaded Archived File===
Sometimes, some software may <u>not</u> be available on repositories to install with the '''yumdnf''' command. They may be available from web-pages to download, and compile. Now that you know how to create and decompress "zipped tarball archives", we will demonstrate how to install applications from websites containing these types of archives. Although this method is not as "user-friendly" as using the yum command, this method is useful if the application is NOT contained in regular software repositories...
In order to build software from source code, you must have the appropriate software development tools (such as make and gcc) and libraries (such as GTK) installed. The required tools will vary depending on the computer languages used in the software being built.
'''Perform the following steps:'''
# Remain in your '''c7hostr9host''' VM, but make certain that you are logged in as a regular user (i.e. NOT root!).# Issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">which lbreakout2lbreakouthd</span></code></b><br>Is there a program called '''lbreakout2''' on your system?# Perform an Internet search for the pattern: <b><code><span style="color:#3366CC;font-size:1.2em;">lbreakout2 lbreakouthd tar.gz</span></code></b># Go to an appropriate webpage and download a "zipped tarball" (compressed source code) for the '''lbreakout2lbreakoutHD''' game (filename should be something like: '''lbreakout2-2.6.5.tar.gz''')
#Change to the directory where you downloaded that file (most likely ''~/Download''s).
# Use the '''tar''' command to decompress the "zipped tarball" called something like (not may be exactly): '''lbreakout2lbreakouthd-21.61.51.tar.gz'''.# Change to the directory that contains that ''lbreakout2lbreakouthd'' source code.
{| width="40%" align="right" cellpadding="10"
|- valign="top"
<ol>
<li value="8">Issue the following command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">./configure && make</span></code></b><br>Most likely, you will get an '''ERROR!''' What do you think the error is telling you?<br></li>
<li>Issue the following command to install the files for application development by issuing the command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">sudo yum dnf groupinstall "Development Tools"</span></code></b></li>
<li>Issue the command in step 7. You should get another ERROR! What dependency is missing?</li>
<li>Issue the following command to install the library files for SQL by issuing the command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">sudo yum dnf install SDL-devel libpng-devel zlib-devel</span></code></b></li>
<li>Reissue the <b><code><span style="color:#3366CC;font-size:1.2em;">./configure && make</span></code></b> command. Were you successful?</li>
<li>Run the command <b><code><span style="color:#3366CC;font-size:1.2em;">lbreakout2lbreakouthd</span></code></b>. Were you successful?</li>
<li>You need to run a command to make this program available regardless of your current directory (as opposed to running command in the directory that contains the program). So, issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">sudo make install</span></code></b></li>
<li>Run the command: <b><code><span style="color:#3366CC;font-size:1.2em;">lbreakout2<lbreakouthd/span></code></b>. Did it work? Issue the command:<br> <b><code><span style="color:#3366CC;font-size:1.2em;">which lbreakout2</span></code></b>. What do you think that the '''make install''' command did?</li>
</ol>
'''Perform the following steps:'''
<ol>
<li> Use your '''c7hostr9host''' VM for this section.</li>
<li>Open a Bash terminal and run the command:
'''Perform the Following Steps:'''
# Make certain that your '''c7hostr9host''' and '''centos3rhel3''' VMs are running.# Switch to your <u>'''c7hostr9host'''</u> machine, open a shell terminal as a regular user, and change to the directory: '''~/bin'''
# Download the Lab 3 check script: <b><code><span style="color:#3366CC;font-size:1.2em;">wget https://raw.githubusercontent.com/OPS245/labs/main/lab3-check.bash</span></code></b><!--<br>For Andrew's sections use this script instead: <b><code><span style="color:#3366CC;font-size:1.2em;">wget http://littlesvr.ca/ops245/lab3-check-andrew.bash</span></code></b>-->
# Give the '''lab3-check.bash''' file execute permissions (for the file owner).
# Run the shell script with <code>sudo</code>, and if any warnings appear, fix the issues noted by the script and rerun the check until you receive the "Congratulations!" message.
# Arrange proof of the following on the screen:<br><span style="color:green;font-size:1.5em;">&#x2713;</span> '''centos3rhel3''':<blockquote><ul><li> Archived files '''created'''</li><li>Archive files '''restored'''</ul></blockquote><span style="color:green;font-size:1.5em;">&#x2713;</span> '''c7hostr9host''':<blockquote><ul><li> '''One repository added''' for yumdnf</li><li>Run the '''lab3-check.bash''' script (must have all <b><code><span style="color:#66cc00;border:thin solid black;font-size:1.2em;">&nbsp;OK&nbsp;</span></code></b> messages)</li></ul></blockquote><span style="color:green;font-size:1.5em;">&#x2713;</span> '''Lab 3''' logbook pages filled out.
# Upload a screen of the proof from the previous step, along with the file generated by '''lab3-check.bash''', your log book, and your '''tarchiver.py''' script to blackboard.
#What does yum do that compiled source code does not?
#Other than running an installed package, what commands can you issue to verify that the package was installed?
#List the steps to remove a package via yum dnf command.#List the steps to install a package using the yum dnf command.#List the steps to add a repository to be used with yumdnf.#What is the command to list all repositories associated with the yum dnf command?
#What is the command to view all repositories that have been added to-date?
#How do you use the '''sed''' command to modify text?

Navigation menu