Changes

Jump to: navigation, search

Lab 3 Warnings / Debrief

8,707 bytes added, 07:59, 13 October 2015
no edit summary
<u>== Rescuing Your System</u>==
{| width="50%" align="right" cellpadding="10"
If you cannot log graphically into your machine (first 3 common problems), there is a trick to boot your system into '''single-user''' mode. This mode does not provide networking, graphics, or logging in as other regular users, but can connect to a text-based interface as the '''root''' user. This method will only work if a GRUB (<u>'''Gr'''</u>and '''<u>U</u>'''nified <u>'''B'''</u>oot-loader) password has not been set, or that you haven't forgotten the GRUB password.
 
 
 
 
'''Steps to Boot into "Single-User Mode":'''
 
{| width="50%" align="right" cellpadding="10"
|- valign="top"
|
[[Image:grub2_1.png|thumb|right|600px|Add the boot option '''single''' and then press '''ctrl-x''' to boot into single user mode]]
|}
#Boot-up your '''centos1''' 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 '''linux16''' 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.
#One thing to look at is partition space usage. Issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">df -h</span></code></b>
#If you notice 0% free space in the '''/''' partition, then there is a problem. This most likely is caused by not following steps to create a <u>compressed</u> copy of the VM image. If that is the case, locate the large image backup and remove it. Do NOT remove the image in ''/var/lib/libvirt/images'' directory!
#You can use the '''passwd''' command to reset your '''regular user''' password (eg. <b><code><span style="color:#3366CC;font-size:1.2em;">passwd regularuserid</span></code></b>). You can press '''ctrl-c''' if you wish to abort (i.e. not change password).
#To restart in graphical mode, simply enter the command <b><code><span style="color:#3366CC;font-size:1.2em;">reboot</span></code></b>.
 
:Unfortunately, this method does not work if you forgot your '''root''' password (To reset your root password, refer to procedure below).
 
 
'''Steps to Reset Root's Password:'''
 
{| width="50%" align="right" cellpadding="10"
|- valign="top"
|
[[Image:grub2_3.png|thumb|right|600px|Add word '''single''' at the end of boot options, '''ENTER''' and press '''b''' to boot ]]
|}
#The procedure to reset root's password is different than shown above. 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 '''linux16''' 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.
#Issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">chroot /sysroot</span></code></b><br><br>
#Issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">passwd root</span></code></b> in order to change your root password (press '''ctrl-c''' if you wish to abort - i.e. not change password).
#To restart in graphical mode, simply enter the command <b><code><span style="color:#3366CC;font-size:1.2em;">reboot</span></code></b>.
 
 
'''Catastrophic Boot Problems:'''
 
:Not being able to start your '''c7host''' 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 '''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!'''
 
 
== Installing Application Software ==
 
There are many different methods and utilities for installing application software depending on the type of Linux distribution you have.
For example:
 
* Debian-based Linux distros: apt-get, debi, gdebi, synaptic package manager, Ubuntu Software Center
* Redhat / Centos / Fedora distros: yum, rpm, gnome-packagekit
 
 
 
We will concentrate on the installing applications for the Centos Linux distribution, and focus on command-line application installation utilities (since centos3 VM is text-based only).
 
 
We will look at a couple methods of installing software: A traditional method ('''compiling source code''') and a more modern method ('''yum install''')
 
 
<u>'''Install Method #1: Compiling Source Code'''</u>
 
This is the original way of installing software in Linux / Unix.
 
 
'''Advantages''':
* Although it seems "out-dated", it may be useful with installing very old or "leading edge" software that are not contained in repositories, and cannot be installed using the ''yum'' utility.
 
 
'''Limitations''':
* Does not automatically resolve "dependency issues". This may require that you first install applications or development libraries before installing the software. This can be cumbersome.
* Cannot use rpm or yum utility to provide information database of installed software.
 
 
'''Steps to Compile Source Code''':
# Obtain compressed file containing source code (usually a "zipped tarball")<br>eg. '''wget [ URL of zipped tarball ]'''
# Decompress zipped tarball. For example '''tar xzvf [ filename.tar.gz | filename.tgz ]'''<br> Note: You can compress (create archives) by using the tar command as well.<br>For example: '''tar czvf [ filename.tar.gz ] [ directories or files to archive ]'''
# Change to directory containing source code. You may need to run a script called '''./config''' (if present) to check for some dependency issues.
# Usually good idea to check for installation instructions in a file called INSTALL and/or README
# Issue the command: '''make''' to compile. This will create an executable file in the source-code directory (usually as a file named after the application).
# As root, issue the command: '''make install''' to make command available to run from any directory. If the ''make install'' command does not work, you can copy the compiled program to '''/bin''', '''/usr/bin''', or '''/usr/local/bin'''.
 
 
<u>'''Install Method #2: Using the '''yum''' Utility'''</u>
 
This is a newer and more preferred method of installing software by command-line on a Redhat / Centos / Fedora Linux distribution. The yum utility is a program which is a <u>'''wrapper'''</u> for the rpm command. A wrapper program simply means a program that uses another utility (in this case, the rpm command). We have used the rpm command to query or determine information regarding installed applications on our Linux systems. When your Linux operating systems were installed, the installation DVD or network media contained rpm files that were installed on the system. Rpm files are simply pre-compiled programs that make it easier to install applications for a Linux system.
 
 
'''Advantages''':
* yum program can install rpm files on a Linux repository (online Linux distribution database) or from local media
* yum program automatically determines "dependency issues", and has them installed first, then install the intended application
* yum program uses rpm utility which can provide rpm queries to determine install application information
 
 
'''Limitations''':
* May not be used for installing very old or "leading edge" software that are not contained in repositories, and cannot be installed using the ''yum'' utility.
 
 
'''Steps to Install using yum Program''':
# List available repositories that you are connected to using the command: '''yum repolist''' (you can use the yum install command to manually add repositories)
# To clean-up the repository list (including downloading new applications in added repositories), issue the command: '''yum clean all'''
 
# To install of remove applications, issue the commands as root: '''yum install packagename''' or '''yum remove packagename'''
# To install applications contained on local media (eg. installation DVD), issue the command: '''yum localinstall [ full_pathname_to_xchat_rpm_file ]'''
# To provide information regarding installed application, issue the command: '''yum info packagename''' or '''rpm -qi packagename'''
 
 
== Common Mistakes / Warnings ==
{{Admon/important |Be Aware of the Following Issues| Be aware of these common mistakes that students make that can cause problems for their future labs.}}
 
* '''FOLLOW THE INSTRUCTIONS CAREFULLY''' in terms of access safe mode, or changing root's password.<br><br>
* You need to be root in order to use '''yum''' utility!
* Remember to backup your VMs after you have completed lab3! Perhaps you can use that shell script to backup all VMs!<br><br>
 
13,420
edits

Navigation menu