Difference between revisions of "OPS235 Lab 1 - Fedora17"

From CDOT Wiki
Jump to: navigation, search
(Investigation 4 - How do you create hard disk partitions?)
 
(114 intermediate revisions by 9 users not shown)
Line 1: Line 1:
= Using Linux to Access Block Devices and Filesystems =
 
 
[[Category:OPS235]][[Category:OPS235 Labs]]
 
[[Category:OPS235]][[Category:OPS235 Labs]]
== Objectives ==
+
{{Admon/caution|THIS IS AN OLD VERSION OF THE LAB|'''This is an archived version. Do not use this in your OPS235 course.'''}}
* Format, mount, use, and unmount ext3, ext4, and vfat filesystems on USB flash drives.
 
* Create filesystems on various storage devices
 
* Create hard disk partitions
 
* Backup filesystems and images
 
* Mount a filesystem stored within a a regular file
 
  
== Reference ==
+
=Fedora 17 Installation (on Main Host - f17host)=
* [http://linuxmanpages.com/ man pages] for cp, mount, umount, fdisk, mkdir, file, mkfs, dumpe2fs, grep, dd
 
* Online reading material for weeks 1 and 2.
 
  
== Required materials ==
 
* [http://fedoraproject.org/get-fedora Fedora 12] Live CD
 
* USB flash drive, 64 MB or more in size (Warning: the contents of this drive will be erased)
 
* One SATA hard disk in a removable drive tray (minimum 80GB)
 
  
== Instructions ==
+
==Introduction==
# Set your computer's drive selector switch to external, then power up the computer.
 
# Insert the Fedora Live CD into the CD/DVD drive.
 
# Reboot the system.
 
# The boot process is completed when you see the GDM Login Screen. Click on "Automatic Login" to login as the "Live System User".
 
# We are going to start by opening a terminal window to access our shell environment. Click on Applications --> System Tools --> Terminal to start the terminal.
 
# At the top of the terminal window,  you should see the command prompt similar to [liveuser@localhost ~]$ This prompt indicates that it is ready to take your command. The program that is running is called a shell.
 
# At the command prompt, enter the command whoami (all in one word) and press return. This command shows the so-called User Name. Make notes of this user name.
 
# At the command prompt, enter the command pwd and press return. This command shows the so-called present working directory or current working directory. Record the present working directory of the shell running on the terminal window. As we have not yet changed directories this should also be your users home directory. (Also indicated by the ~ character in the prompt)
 
  
{{Admon/important|Using Superuser Privilege|Throughout this course, you may need to execute commands using the privileges of the the administrative user (username "root", also called the "superuser"). To switch from your account to the root account, type the command: <code>su -</code>
+
:* In this lab, you are going to install the Fedora (GNU/Linux Distribution) to your removable hard disk from your burned DVD.
  
After switching user notice and make note of the change in your shell prompt. Also note the difference in output for the <code>whoami</code> and <code>pwd</code> commands.
+
:* Although this will be a simple install, this Fedora Operating System will be a platform for other Virtual Machine Fedora installations (in future labs). Therefore, it is very important that you take the time to carefully read and perform ALL steps, and take time to check your work.
  
Whenever this is required, make a note of it, and determine why superuser privilege is required.
+
:* After performing the Fedora17 DVD installation, you will collect baseline information about your Fedora GNU/Linux system, and perform some post installation configuration to prepare your system for the remainder of the labs.
  
When you are finished using the root account type exit to return to your previous account. Avoid using the superuser account unless absolutely necessary, because the superuser account has unlimited privilege and a typo can destroy your system.
+
==Objectives==
 +
 
 +
# Perform a GNU/Linux installation using the Fedora 17 distribution
 +
# Investigate information during and after the Fedora 17 installation
 +
# Perform an update after a recent installation
 +
 
 +
==Required Materials (Bring to All Labs)==
 +
 
 +
* Fedora 17 LIVE CD
 +
* Fedora 17 x86_64 Installation DVD
 +
* SATA Hard Disk (in removable disk tray)
 +
* USB Memory Stick
 +
* Lab Logbook
 +
 
 +
==Prerequisites==
 +
 
 +
* None (First Lab)
 +
 
 +
==Linux Command Online Reference==
 +
 
 +
Each Link below displays online manpages for each command (via [http://linuxmanpages.com/ http://linuxmanpages.com]):
 +
 
 +
{|width="100%" cellpadding="5" width="50%"
 +
|'''Utilities:'''
 +
|- valign="top"
 +
|
 +
:* [http://linuxmanpages.com/man8/rpm.8.php rpm]
 +
:* [http://linuxmanpages.com/man1/hostname.1.php hostname]
 +
:* [http://linuxmanpages.com/man1/uname.1.php uname]
 +
:* [http://linuxmanpages.com/man1/ps.1.php ps]
 +
:* [http://linuxmanpages.com/man8/ifconfig.8.php ifconfig]
 +
:* [http://linuxmanpages.com/man8/netstat.8.php netstat]
 +
:* [http://linuxmanpages.com/man8/route.8.php route]
 +
:* [http://linuxmanpages.com/man1/nslookup.1.php nslookup]
 +
:* [http://linuxmanpages.com/man1/wc.1.php wc]
 +
|}
 +
 
 +
Normally you would read man pages on the machine you're working on using the man command, for example '''man rpm''' will show you the manual page for the rpm command.
 +
 
 +
==Resources on the web==
 +
Additional links to tutorials and HOWTOs:
 +
:* [http://docs.fedoraproject.org/en-US/Fedora/17/html/Installation_Guide/  Fedora 17 Installation Guide]
 +
 
 +
=Performing Lab 1=
 +
 
 +
==Investigation 1: How to Perform a Fedora DVD Install on Your Removable Hard Drive ==
 +
 
 +
=== Part 1: Simple Things ===
 +
 
 +
# Insert your '''removable SATA hard disk''' into the drive tray.
 +
# Set your computer's drive selector switch to '''external''' (a.k.a ''position #4'').
 +
# Power up the computer and insert the '''Fedora 17 Installation DVD''' into the CD/DVD drive.
 +
# Wait until the Fedora DVD boots (could take a few moments).
 +
 
 +
{{Admon/important|Boot-up Issues (Fedora17) in Seneca's Computer labs|If for some reason, the Fedora17 Installation DVD does not boot:
 +
 
 +
:* Restart the computer, and '''press the function key F10 to specify the device to boot''' (eg. DVD drive).  
 +
:* If the user is prompted for a password, '''simply press ENTER''' (without typing any password) at the password prompt.
 +
:* Choose the DVD drive from the list of devices avalable for boot.
 +
:* You will need to perform this technique to ensure that Fedora boots from the hard drive (in future labs).
 +
:* If you have tried this technique, and the Fedora Installation DVD does not boot, you may have to burn a new Fedora Installation DVD.|
 
}}
 
}}
  
{{Admon/note|Disabling the Auto-mounting of Devices|At this point we need to disable the ability for our linux system to automatically detect and mount removeable media. This would interfere with the learning objectives of the rest of the lab. To do this enter the command: <code>pkill hald</code>. '''You will need to do this again if you reboot during this lab.'''}}
+
<ol>
 +
<li value="5">Note the time at the beginning of your installation.</li>
 +
<li>When the Fedora17 Installation DVD boots, it will prompt the user to test the media (i.e. DVD) for integrity. Since time is limited for installation in the lab, select '''SKIP'''. On the other hand, if the install did not work, then you can test out the integrity of the DVD in the computer lab during your spare time.</li>
 +
<li>Select the default language ('''English''') in the next install screen, and click '''Next'''.</li>
 +
<li>Select the default '''keyboard layout''' and '''Basic Storage Devices''' in the following installation screens.</li>
 +
<li>Set your hostname (name of the computer) to <big>'''f17host'''</big> (one word, no space, all lowercase).</li>
 +
<li>Set your time zone to '''Toronto'''. Note that the system (BIOS) clock is set to local time, not UTC.</li>
 +
<li>Root Password: enter a password of your own choosing. Pick one that is hard to guess to protect your system. (Recommendation: use the first letter and all the punctuation from a favorite phrase or song verse. For example, "To be or not to be, that is the question!" could become the password "Tbontb,titq!").</li>
 +
</ol>
 +
 
 +
=== Part 2: Partitioning ===
 +
 
 +
{{Admon/tip |You're supposed to use this hard drive only for this course| But if you really need to use it for two courses, and the professor for the other (probably windows)  course will allow it - ask your professor for help with partitioning.}}
 +
 
 +
<ol>
 +
<li>If you get a warning with something like "This device may contain data" - it's probably your new hard drive and you can safely use it.</li>
 +
<li>Select '''Create Custom Layout''', we don't want to use the Fedora default setup now.</li>
 +
<li>On your drive you will need at least the following partitions. These may be primary partitions or logical drives. If you have more space than 250GB available - you can add the extra space in equal parts to /home and /var/lib/libvirt/images</li>
 +
<ul><li>'''20GB''' for '''/'''  (i.e. "root")</li>
 +
    <li>'''30GB''' for /home</li>
 +
    <li>'''8GB''' for '''swap''' (Note: "swap" must be selected from the drop down menu)</li>
 +
    <li>'''100GB''' for '''/var/lib/libvirt/images'''</li></ul>
 +
<li>Record briefly in your lab logbook what partitions you created of what size and what device names were assigned to them (/dev/sda1, etc.).</li>
 +
</ol>
 +
 
 +
=== Part 3: Completing Installation ===
 +
 
 +
<ol>
 +
<li>Select in the next screen the '''Graphical Desktop''' applications, and in the additional repositories section (at the bottom) accept the default settings, then proceed. You may look at what's available if you choose "Customize now" but you don't need to customize the software installed at this point.</li>
 +
<li>Add in your lab logbook a brief description of the term "software repository" and what its major purpose serves (what you think it does). We will not add any existing repositories since we are not currently connected to the Internet. Therefore, we will customize the repositories later.</li>
 +
<li>'''Proceed with the installation. This may take some time'''. Record in your lab log-book the <u>general</u> steps in the installation process (displayed in the dialog box).</li>
 +
<li>When installation is complete, a screen will confirm completion, and ask the user to remove the DVD, and reboot the computer. Write in your lab log-book the time it took to perform this DVD Fedora install.</li>
 +
<li>Remove the Fedora Installation DVD, and click '''Reboot'''.</li>
 +
 
 +
<li>When the system starts, set or accept the time and date default.</li>
 +
<li>Create a user account for yourself using the same user ID as your learn account, and create a suitable password.</li>
 +
<li>Normally, you would want to enable '''Network Time Protocol''', but since we will be experimenting with the networking turned off in later labs, '''leave it disabled'''.</li>
 +
<li> Click on '''Do Not Send Hardware Profile'''.</li>
 +
<li>Finish the post-installation customization, wait for the login screen to appear, and then login to your computer account and your created (i.e. your name).</li>
 +
<li>Proceed to Investigation 2</li>
 +
</ol>
 +
 
 +
'''Answer the Investigation 1 observations / questions in your lab log book.'''
 +
 
 +
==Investigation 2: How many file packages and files are installed on the system?==
 +
 
 +
'''For the rest of the tasks in this lab, you must login to your installed Fedora system using your Learn account, open a terminal and execute the following listed Linux commands to obtain information for your lab-logbook''' (lab1). If you get a Permission Denied message when trying to execute a command, then switch to the '''superuser''' account by running the command '''su -'''  and type in your password for "root" (since you are the main administrator for your Fedora system). Once the intended command is executed, type "exit" to exit from the superuser account and return to your regular Learn account.
 +
 
 +
 
 +
{{Admon/important|Using Superuser Privilege|Throughout this course, you may need to execute commands using the privileges of the the administrative user (username "root", also called the "superuser"). To switch from your account to the root account, type the command: <code>su</code>
 +
 
 +
After switching user notice and make note of the change in your shell prompt. Also note the difference in output for the <code>whoami</code> and<code>pwd</code> commands.
 +
 
 +
'''Whenever this is required, make a note of it, and determine why superuser privilege is required.'''
 +
 
 +
When you are finished using the root account type exit to return to your previous account. '''Avoid using the superuser account unless absolutely necessary, because the superuser account has unlimited privilege and a typo can destroy your system.'''
 +
 
 +
In some documentation, you may see the command <code>su -</code> used in place of <code>su</code>. The dash argument causes <code>su</code> to go through the steps that would normally be performed when the root user logs in, including (1) running the startup scripts (such as<code>/etc/profile</code> and <code>/root/.bash_profile</code> and (2) changing to the root user's home directory (<code>/root</code>).
 +
 
 +
Note that the root user's home directory (<code>/root</code>) is ''not'' the same as the root directory of the system (<code>/</code>). It is also in a different directory than the rest of the home directories, which are typically in <code>/home</code> -- the reason for this is that <code>/home</code> is sometimes on a network filesystem shared by another server (as is the case on Matrix), and it's important that the system administrator be able to log in to the system even if the network is not operating normally.
 +
}}
 +
 
 +
 
 +
Navigate through your Graphical Fedora system, '''locate and run a terminal program (in order to issue Linux commands). Issue and record the commands used and the output generated in each of the following steps:'''
 +
 
 +
# The name of the installation log file is <code>'''/root/install.log'''</code> -- It is an ASCII file (how can you be sure?) which can be viewed with the <code>'''less'''</code> command.
 +
# You can make use of this file to determine how many packages have been installed: complete the following command to count the number of packages that are labelled "Installing" in the installation log file:
 +
:: <code>'''grep ________________ /root/install.log | wc -l'''</code>
 +
<ol>
 +
<li value="3">Using the <code>rpm</code> command: you can also use the following commands to list all the installed packages, and the total number of packages installed:</li>
 +
</ol>
 +
:: <code>'''rpm -q -a'''</code>
 +
:: <code>'''rpm -q -a | wc -l'''</code>
 +
:: <code>'''rpm -qa  | wc -l'''</code>
 +
<ol>
 +
<li value="4">The <code>'''-q'''</code> option means query, and the <code>'''-a'''</code> option means all (in other words, query all installed software packages). Did you get the same number of packages from the above two methods?</li>
 +
<li>Some of the files on your system were installed with the software packages, and some were created by system activity (for example, by creating your Learn account and by logging in). If you know the package name (from the <code>install.log</code>), you can list all the files that were installed from the package by using the following command:</li>
 +
</ol>
 +
:: <code>'''rpm -q -l package_name'''</code><br />(where '''package_name''' represents the name of the ''application'' or ''package'')
 +
<ol>
 +
<li value="6">This combines the <code>'''-q'''</code> (query) option with the <code>'''-l'''</code> (list filenames) option</li>
 +
<li>You can pipe the outupt through <code>'''wc -l'''</code> to count the number of lines:</li>
 +
</ol>
 +
:: <code>'''rpm -ql package_name| wc -l'''</code>
 +
<ol>
 +
<li value="8">Using what you learned in steps 3, 4, and 7, get a count of the total number of files installed by all of the software packages on your system.</li>
 +
<li>To find out the name that you have assigned to your Linux system, enter the command:  <code>'''hostname'''</code></li>
 +
<li>To find out the kernel version of your GNU/Linux workstation and the date it was created, enter the command:  <code>'''uname -rv'''</code></li>
 +
<li>To find out all the system processes running on your GNU/Linux workstation, enter the command: <code>'''ps -ef'''</code></li>
 +
<li>To capture the list of all the system processes to a file called <code>'''ps.lst'''</code>, enter the command: <code>'''ps -ef > ps.lst'''''</code></li>
 +
</ol>
 +
 
 +
{{Admon/important|Pathname for USB Stick|The procedure has changed to refer to the usb device for distributions prior to Fedora17 (eg. /media/usb-device-name). For Fedora17, the new device pathname is:<br /><b>/run/media/userloginid/usb-device-name</b> .<br /><br />Note: You can press the <b>tab</b> key to guess what the userloginname/usb-device-name is...}}
 +
 
 +
<ol>
 +
<li value="13">Copy the installation log file <code>'''/root/install.log'''</code> and the file '''ps.lst''' to a USB memory key, or '''scp''' to your matrix account as a backup.</li>
 +
</ol>
 +
 
 +
{{Admon/tip |Backup up to your USB Key|When your USB key is inserted into your computer, the device is recognised and assigned a name. You can view your USB drive by issuing the command <code>ls /run/media/yourusername</code> and view the mounted devices. Then you can issue a Linux command as "super-user" to copy the files to your USB device.}}
 +
<ol>
 +
<li value="14">View the section below to learn about and perform an update on your fresh Fedora install (you may have to find spare time to perform this install if you are running short on lab time). '''Do <u>not</u> proceed to Investigation 3 without performing an update'''.</li>
 +
</ol>
 +
 
 +
{{Admon/tip |Consider Remaining Lab Time Prior to Performing Upgrade|'''Carefully check the remaining time in your lab prior to performing an upgrade on the operating system'''. It can take 30 - 90 minutes to perform an upgrade...}}
 +
 
  
=== Investigation 1: How does Linux enable you to access two different drives without using a drive designator? ===
+
{{Admon/tip |Updating Fedora|The Fedora software is updated frequently to add features, fix bugs, and upgrade security. '''Perform a system update to get the latest versions of the packages installed in Fedora: Start the Firefox web browser, turn off popup window blocking (select ''Edit>Preferences'', then select the Content tab and uncheck the box to Block Popups), then login to SeneNET. Open a terminal and type <code>su</code> to start a shell as root. Enter the command <code>yum update</code>''' This will download and install all of the packages that have been updated since the installation DVD image was created. If you complete this command at Seneca it should run quite fast as Seneca College hosts a Fedora Repository mirror (a copy of all of the current fedora packages, on a local web server).}}
# Type the command mount. Describe the output of the command in your lab log. What do the fields of data represent? Use the man page for the mount command and google searches to find this information
 
# Insert your USB flash drive into a USB port on the computer.
 
# Because we have turned off the automatic mounting feature nothing will happen. In order to access the file system on this storage device we must mount it on to our existing file/directory structure.
 
# To mount a device we must first create a mount point to mount it on. Create a new directory called <code>/media/usb</code> (These steps should be done as "root")
 
# Next we need to use the mount command to mount the device. Try typing the following command: <code>mount -t vfat /dev/sdb1 /media/usb</code>. This command contains 3 important pieces of information (command arguments):
 
#* <code>-t vfat</code> tells the mount command to mount it as a FAT filesystem. (Most likely choice for a USB flash drive)
 
#* <code>/dev/sdb1</code> tells the mount command which device to mount. (If this didn't work try <code>/dev/sdc1</code> or <code>/dev/sda1</code>)
 
#* <code>/media/usb</code> tells the mount command where to mount the device (the "mount point")
 
# Type the command mount and compare the output with the output from step 9. Record what has changed.
 
# What file system type is the USB device mounted as? Where was it mounted? What is the device name?
 
# Create a file in the directory /media/usb/ by redirecing the output of the cal command: cal >/media/usb/month
 
# Display a detailed listing of the directory where the device is mounted and record the output: ls -l /media/usb
 
# Type the command umount /media/usb -- What happened to the contents of the /media/usb directory? Compare results with step 17.
 
# Type the command mount and observe the output. What is different from step 14? Why?
 
# Make a new mount point called /media/usb2 Mount your usb flash drive on the new mount point.
 
# Display a detailed listing of the new mount point again. Is your file there?
 
  
Answer the Investigation 1 question: How does Linux enable you to access two different drives without using a drive designator? (Write the answer in your lab log book).
+
'''Answer the Investigation 2 observations / questions in your lab log book.'''
  
=== Investigation 2: How do you create a vfat or ext3 filesystem? ===
+
== Investigation 3: What is the network configuration? ==
  
{{Admon/tip | Flash drives with no partition table | If your device name ends in a letter (for example, it is <code>/dev/sdb</code> instead of <code>/dev/sdb1</code>), add <code>-I</code> to the <code>mkfs</code> commands in this section. This is because your USB flash drive does not have a partition table, which normally causes an error; the <code>-I</code> option tells mkfs to proceed anyways.}}
 
  
# Unmount your USB flash drive.
+
{{Admon/tip |Rusty Issuing Linux commands since ULI101?|To be an effective Linux administrator, you need to become comfortable on issuing Linux commands in a shell, and use resources to quickly learn how to properly formulate Linux commands...<br /><br />You can run the following online tutorials to practice (refresh) issuing Linux commands. These tutorials were designed for another course called "OPS435", but you can still use them for practice. Simply open a shell, SSH into the Matrix server (eg. ssh yourusername@matrix.senecac.on.ca) and run the following 4 tutorials (you can copy and paste these separate pathnames and run like a program):<br /><br />'''/home/ops435/tutorials/tutorial1<br />/home/ops435/tutorials/tutorial2<br />/home/ops435/tutorials/tutorial3<br />/home/ops435/tutorials/vi-tutorial'''<br /><br />You can also refer to the section above called '''Linux Command Online Reference''' to see how use use the following Linux commands to obtain the required information.}}
# Enter the command: <code>mkfs -t ext3 /dev/sdb1</code>
 
#* What is the purpose of this command? Use the man page for mkfs to research what you did with this command.
 
#* Did we execute the command on the device name or the mount point?
 
# Attempt to mount the USB flash drive using the command you used in Investigation 1. What was the result?
 
# Check the man page for the mount command to see how to change your command to mount the device correctly, and issue that command.
 
# Once the device is mounted do a long directory listing of the mount point. What has changed?
 
# Do an internet search to find out what the <code>lost+found</code> directory is for. Record your findings in your notes.
 
# Create a new file on the device using the same technique used in Investigation 1.
 
# Unmount the device and remount it on the original mount point. Is the new file there?
 
# Type the command mount and observe the type value for the USB flash drive filesystem. Compare this value to the type found in Investigation 1.
 
# Change your current working directory to where the device is mounted.
 
# Attempt to unmount the USB flash drive. What was the result? Why? Record your findings in your notes.
 
# Solve the error and unmount the device.
 
# Consult the man pages for <code>mkfs</code> and <code>mkfs.ext3</code> to see how to reformat the device to a ext3 file system with a volume label that is the same as your learn ID.
 
# Enter the command to reformat the device.
 
# The <code>dumpe2fs /dev/sdb1</code> command will allow us to see detailed information about ext3 filesystems. Use it to confirm your volume label is correct and record the size of your journal.
 
# Mount the device again as an ext3 filesystem.
 
# While the device is still mounted reformat the device as a vfat filesystem. What error message did you receive? Why? Record your conclusions in your notes.
 
# Unmount the device and format it as vfat.
 
# Now you will investigate what happens when you copy files to the device name rather than the mount point. Issue the command cp /etc/hosts /dev/sdb1
 
# Now mount your device. Was it successful? Try mounting it as ext3. Was it successful? What has happened to the filesystem on the device?
 
# Reformat it as vfat and mount it.
 
# Unmount the device.
 
  
===Investigation 3: How do you create an ext3 filesystem on a USB flash drive with a volume label?===
+
# To check the network configuration settings obtained from the DHCP server, run the following commands, describing the output in your log book:
 +
#* '''ifconfig'''
 +
#* '''route'''
 +
#* '''nslookup''' (at the > prompt, enter the word "server" (do not type the quotes) and record the output. Type exit to leave nslookup).<br /><br />
 +
# Find the following information in the output of the above commands:
 +
#* '''MAC address''' (physical or hardware address) of the ethernet network interface
 +
#* '''Subnet mask'''
 +
#* '''The IP address''' (logical address) assigned by the DHCP server
 +
#* '''The default route''' (gateway)
 +
#* '''The DNS nameserver'''
  
{{Admon/tip | Tip: | Check the man page for <code>dumpe2fs</code>.}}
+
'''Answer the Investigation 3 observations / questions in your lab log book.'''
# Shutdown your computer. (Under the "System" menu)
 
# Insert your removable SATA hard disk, remove your USB flash drive and restart the computer. (Leave your "Live CD" in the computer)
 
# When the computer has restarted and you have logged in. Insert your USB flash drive into the USB port.
 
# Open a terminal window and run the <code>mount</code> command.
 
# It is quite possible that the device name for your USB flash drive has changed from what you were using previously. Your hardware configuration is different because now you have a hard drive connected. One way to determine what your USB device name is now is to look at the system log. Use the tail command to view the last 20 lines of the file <code>/var/log/messages</code> There should be kernel entries that were generated when you inserted the device.
 
# Create a Linux ext3 filesystem on the USB device, giving it a volume label of "Lab1", and record the following in in your logbook:
 
#* What is the block size for the new format?
 
#* How many blocks were created?
 
#* How often will the new filesystem be automatically checked?
 
#* What volume label was given to the filesystem?
 
# According to the man page what is the purpose of dumpe2fs?
 
# If you executed dumpe2fs on an MS-DOS filesystem what do you think would be the result?
 
# Mount the USB device onto the mount point  /media/lab1
 
# Copy the files <code>/etc/services</code>,<code>/etc/networks</code> to the USB flash drive.
 
  
===Investigation 4 - How do you create hard disk partitions?===
+
== Investigation 4: SELinux ==
  
* Enter the command  <code>fdisk -l /dev/sda</code> and describe the output in your log book. The output may be similar to the following:
 
  
    Disk /dev/sda: 12.0 GB, 12072517632 bytes
+
{{Admon/important|SELinux|SELinux stands for '''Security-Enhanced Linux'''. It is a component that helps to better secure the system to protect against intrusion (hackers). Usually, SELinux is enabled upon the default install of Fedora. SELinux can be a good thing, if you take care of it and are aware that it is enabled or disabled. It is recommended that you '''disable SELinux by default''' for this course, since you will be communicating with other virtual machines and can cause machines NOT to communicate.}}
    255 heads, 63 sectors/track, 1467 cylinders
 
    Units = cylinders of 16065 * 512 = 8225280 bytes
 
    Device Boot Start End Blocks Id System
 
    ...
 
* Read and study this [http://tldp.org/HOWTO/Partition/fdisk_partitioning.html reading] about how to use the fdisk command before you go on to the next step.
 
* Review the man page for the fdisk command.
 
  
{{Admon/caution | Important/warning! | The following operation will erase the contents of your hard disk. If you have any useful data stored on your disk, you must back it up first or use another hard disk that does not contain useful data on it.|Do not plan on sharing the hard disk with the Windows course! You will be doing lots of tasks that may cause you to lose your data.}}
+
# Disabling SELinux on Fedora is actually quite simple, just edit the file '''/etc/selinux/config''' and change the following line to look like this:
# Enter the command  fdisk /dev/sda  to start the hard disk partition program.
+
#* SELINUX=disabled
# At the fdisk command prompt, enter the letter  '''p'''  to print out the current partition table of the hard disk. If there are any partitions, use the '''d''' option to delete all of them, starting with the highest partition number first.
 
# At the fdisk command prompt, use the '''n''' and '''t''' commands to create these three partitions:
 
                  /dev/sda1 - 300MB (primary, Linux Native)
 
                  /dev/sda2 - the rest of the hard disk (extended)
 
                  /dev/sda5 - 300MB (logical, Linux Native)
 
* Use the '''p''' option the display the new partition and record it in your log book.
 
* Remember to use the '''w''' option to write the new partitions information instead of the '''q''' option to quit without saving.
 
* Logout and restart Fedora.
 
  
Answer the Investigation 4 question in your lab log book.
+
= Completing the Lab =
  
=== Completing the Lab ===
+
'''Check off the following items before asking your instructor to check your lab:'''
  
Arrange evidence of each of the following items on the screen, and then ask your professor or lab monitor to check them:
+
* '''Task 1''' - Install GNU/Linux Workstation using Fedora
 +
* '''Task 2''' - Collect system information after installation.
 +
* '''Task 3''' - Fedora Updated
 +
* '''Task 4''' - Collect network information
  
# USB Formatted as ext2 (    )
+
'''Arrange evidence for each of these items on your screen, then ask your instructor to review them and sign off on the lab's completion:'''
# Volume Label is "LAB1" (    )
 
# USB Mounted on <code>/media/lab-one</code> (    )
 
# Following files on USB services, issue, networks (    )
 
# Instructor satisfied with complete and detailed lab notes (    )
 
  
== Preparing for the Quizzes ==
+
* Can login with your "learn" account name
 +
* Has the package count
 +
* Has correct size partitions for:
 +
:* '''root /''' (20GB), '''/home''' (30GB), '''swap''' (8GB)
 +
:* '''/var/lib/libvirt/images''' (100GB)
 +
:* Hint: Can issue '''lsblk''' (listblock command)
 +
* Has the correct IP address and MAC address
 +
* Find out the default route (gateway)
 +
* IP of the DNS name server
 +
* Name and contact information on your disk pack
 +
* Lag Logbook (lab1) notes filled-in.
  
The online readings linked on the course web page contain some useful information about Free and Open Source Software. Use them and Internet searches to answer the following questions to help you prepare for the quizzes:
+
= Preparing for Quizzes =
  
# Who is Linus Torvalds?
+
# How many packages were installed?
# Name 3 open source software projects widely used today?
+
# How many files (correct to the nearest hundred) were installed?
# What license agreement does GNU/Linux use?
+
# How many users were created automatically on your system (do not count your learn account)?
# What are the 4 basic software freedoms that define "Free Software"?
+
# What is your learn account's UID and GID?
# Who makes up the Fedora Community?
+
# What is your learn account's home directory?
# Name 4 other significant Linux "Distros"
+
# What is the home directory for the user "root"?
 +
# How do you determine the host name of your GNU/Linux workstation?
 +
# What command can display the NIC's MAC address?

Latest revision as of 11:26, 24 September 2018

Stop (medium size).png
THIS IS AN OLD VERSION OF THE LAB
This is an archived version. Do not use this in your OPS235 course.

Fedora 17 Installation (on Main Host - f17host)

Introduction

  • In this lab, you are going to install the Fedora (GNU/Linux Distribution) to your removable hard disk from your burned DVD.
  • Although this will be a simple install, this Fedora Operating System will be a platform for other Virtual Machine Fedora installations (in future labs). Therefore, it is very important that you take the time to carefully read and perform ALL steps, and take time to check your work.
  • After performing the Fedora17 DVD installation, you will collect baseline information about your Fedora GNU/Linux system, and perform some post installation configuration to prepare your system for the remainder of the labs.

Objectives

  1. Perform a GNU/Linux installation using the Fedora 17 distribution
  2. Investigate information during and after the Fedora 17 installation
  3. Perform an update after a recent installation

Required Materials (Bring to All Labs)

  • Fedora 17 LIVE CD
  • Fedora 17 x86_64 Installation DVD
  • SATA Hard Disk (in removable disk tray)
  • USB Memory Stick
  • Lab Logbook

Prerequisites

  • None (First Lab)

Linux Command Online Reference

Each Link below displays online manpages for each command (via http://linuxmanpages.com):

Utilities:

Normally you would read man pages on the machine you're working on using the man command, for example man rpm will show you the manual page for the rpm command.

Resources on the web

Additional links to tutorials and HOWTOs:

Performing Lab 1

Investigation 1: How to Perform a Fedora DVD Install on Your Removable Hard Drive

Part 1: Simple Things

  1. Insert your removable SATA hard disk into the drive tray.
  2. Set your computer's drive selector switch to external (a.k.a position #4).
  3. Power up the computer and insert the Fedora 17 Installation DVD into the CD/DVD drive.
  4. Wait until the Fedora DVD boots (could take a few moments).
Important.png
Boot-up Issues (Fedora17) in Seneca's Computer labs
If for some reason, the Fedora17 Installation DVD does not boot:
  • Restart the computer, and press the function key F10 to specify the device to boot (eg. DVD drive).
  • If the user is prompted for a password, simply press ENTER (without typing any password) at the password prompt.
  • Choose the DVD drive from the list of devices avalable for boot.
  • You will need to perform this technique to ensure that Fedora boots from the hard drive (in future labs).
  • If you have tried this technique, and the Fedora Installation DVD does not boot, you may have to burn a new Fedora Installation DVD.
  1. Note the time at the beginning of your installation.
  2. When the Fedora17 Installation DVD boots, it will prompt the user to test the media (i.e. DVD) for integrity. Since time is limited for installation in the lab, select SKIP. On the other hand, if the install did not work, then you can test out the integrity of the DVD in the computer lab during your spare time.
  3. Select the default language (English) in the next install screen, and click Next.
  4. Select the default keyboard layout and Basic Storage Devices in the following installation screens.
  5. Set your hostname (name of the computer) to f17host (one word, no space, all lowercase).
  6. Set your time zone to Toronto. Note that the system (BIOS) clock is set to local time, not UTC.
  7. Root Password: enter a password of your own choosing. Pick one that is hard to guess to protect your system. (Recommendation: use the first letter and all the punctuation from a favorite phrase or song verse. For example, "To be or not to be, that is the question!" could become the password "Tbontb,titq!").

Part 2: Partitioning

Idea.png
You're supposed to use this hard drive only for this course
But if you really need to use it for two courses, and the professor for the other (probably windows) course will allow it - ask your professor for help with partitioning.
  1. If you get a warning with something like "This device may contain data" - it's probably your new hard drive and you can safely use it.
  2. Select Create Custom Layout, we don't want to use the Fedora default setup now.
  3. On your drive you will need at least the following partitions. These may be primary partitions or logical drives. If you have more space than 250GB available - you can add the extra space in equal parts to /home and /var/lib/libvirt/images
    • 20GB for / (i.e. "root")
    • 30GB for /home
    • 8GB for swap (Note: "swap" must be selected from the drop down menu)
    • 100GB for /var/lib/libvirt/images
  4. Record briefly in your lab logbook what partitions you created of what size and what device names were assigned to them (/dev/sda1, etc.).

Part 3: Completing Installation

  1. Select in the next screen the Graphical Desktop applications, and in the additional repositories section (at the bottom) accept the default settings, then proceed. You may look at what's available if you choose "Customize now" but you don't need to customize the software installed at this point.
  2. Add in your lab logbook a brief description of the term "software repository" and what its major purpose serves (what you think it does). We will not add any existing repositories since we are not currently connected to the Internet. Therefore, we will customize the repositories later.
  3. Proceed with the installation. This may take some time. Record in your lab log-book the general steps in the installation process (displayed in the dialog box).
  4. When installation is complete, a screen will confirm completion, and ask the user to remove the DVD, and reboot the computer. Write in your lab log-book the time it took to perform this DVD Fedora install.
  5. Remove the Fedora Installation DVD, and click Reboot.
  6. When the system starts, set or accept the time and date default.
  7. Create a user account for yourself using the same user ID as your learn account, and create a suitable password.
  8. Normally, you would want to enable Network Time Protocol, but since we will be experimenting with the networking turned off in later labs, leave it disabled.
  9. Click on Do Not Send Hardware Profile.
  10. Finish the post-installation customization, wait for the login screen to appear, and then login to your computer account and your created (i.e. your name).
  11. Proceed to Investigation 2

Answer the Investigation 1 observations / questions in your lab log book.

Investigation 2: How many file packages and files are installed on the system?

For the rest of the tasks in this lab, you must login to your installed Fedora system using your Learn account, open a terminal and execute the following listed Linux commands to obtain information for your lab-logbook (lab1). If you get a Permission Denied message when trying to execute a command, then switch to the superuser account by running the command su - and type in your password for "root" (since you are the main administrator for your Fedora system). Once the intended command is executed, type "exit" to exit from the superuser account and return to your regular Learn account.


Important.png
Using Superuser Privilege
Throughout this course, you may need to execute commands using the privileges of the the administrative user (username "root", also called the "superuser"). To switch from your account to the root account, type the command: su

After switching user notice and make note of the change in your shell prompt. Also note the difference in output for the whoami andpwd commands.

Whenever this is required, make a note of it, and determine why superuser privilege is required.

When you are finished using the root account type exit to return to your previous account. Avoid using the superuser account unless absolutely necessary, because the superuser account has unlimited privilege and a typo can destroy your system.

In some documentation, you may see the command su - used in place of su. The dash argument causes su to go through the steps that would normally be performed when the root user logs in, including (1) running the startup scripts (such as/etc/profile and /root/.bash_profile and (2) changing to the root user's home directory (/root).

Note that the root user's home directory (/root) is not the same as the root directory of the system (/). It is also in a different directory than the rest of the home directories, which are typically in /home -- the reason for this is that /home is sometimes on a network filesystem shared by another server (as is the case on Matrix), and it's important that the system administrator be able to log in to the system even if the network is not operating normally.


Navigate through your Graphical Fedora system, locate and run a terminal program (in order to issue Linux commands). Issue and record the commands used and the output generated in each of the following steps:

  1. The name of the installation log file is /root/install.log -- It is an ASCII file (how can you be sure?) which can be viewed with the less command.
  2. You can make use of this file to determine how many packages have been installed: complete the following command to count the number of packages that are labelled "Installing" in the installation log file:
grep ________________ /root/install.log | wc -l
  1. Using the rpm command: you can also use the following commands to list all the installed packages, and the total number of packages installed:
rpm -q -a
rpm -q -a | wc -l
rpm -qa | wc -l
  1. The -q option means query, and the -a option means all (in other words, query all installed software packages). Did you get the same number of packages from the above two methods?
  2. Some of the files on your system were installed with the software packages, and some were created by system activity (for example, by creating your Learn account and by logging in). If you know the package name (from the install.log), you can list all the files that were installed from the package by using the following command:
rpm -q -l package_name
(where package_name represents the name of the application or package)
  1. This combines the -q (query) option with the -l (list filenames) option
  2. You can pipe the outupt through wc -l to count the number of lines:
rpm -ql package_name| wc -l
  1. Using what you learned in steps 3, 4, and 7, get a count of the total number of files installed by all of the software packages on your system.
  2. To find out the name that you have assigned to your Linux system, enter the command: hostname
  3. To find out the kernel version of your GNU/Linux workstation and the date it was created, enter the command: uname -rv
  4. To find out all the system processes running on your GNU/Linux workstation, enter the command: ps -ef
  5. To capture the list of all the system processes to a file called ps.lst, enter the command: ps -ef > ps.lst
Important.png
Pathname for USB Stick
The procedure has changed to refer to the usb device for distributions prior to Fedora17 (eg. /media/usb-device-name). For Fedora17, the new device pathname is:
/run/media/userloginid/usb-device-name .

Note: You can press the tab key to guess what the userloginname/usb-device-name is...
  1. Copy the installation log file /root/install.log and the file ps.lst to a USB memory key, or scp to your matrix account as a backup.
Idea.png
Backup up to your USB Key
When your USB key is inserted into your computer, the device is recognised and assigned a name. You can view your USB drive by issuing the command ls /run/media/yourusername and view the mounted devices. Then you can issue a Linux command as "super-user" to copy the files to your USB device.
  1. View the section below to learn about and perform an update on your fresh Fedora install (you may have to find spare time to perform this install if you are running short on lab time). Do not proceed to Investigation 3 without performing an update.
Idea.png
Consider Remaining Lab Time Prior to Performing Upgrade
Carefully check the remaining time in your lab prior to performing an upgrade on the operating system. It can take 30 - 90 minutes to perform an upgrade...


Idea.png
Updating Fedora
The Fedora software is updated frequently to add features, fix bugs, and upgrade security. Perform a system update to get the latest versions of the packages installed in Fedora: Start the Firefox web browser, turn off popup window blocking (select Edit>Preferences, then select the Content tab and uncheck the box to Block Popups), then login to SeneNET. Open a terminal and type su to start a shell as root. Enter the command yum update This will download and install all of the packages that have been updated since the installation DVD image was created. If you complete this command at Seneca it should run quite fast as Seneca College hosts a Fedora Repository mirror (a copy of all of the current fedora packages, on a local web server).

Answer the Investigation 2 observations / questions in your lab log book.

Investigation 3: What is the network configuration?

Idea.png
Rusty Issuing Linux commands since ULI101?
To be an effective Linux administrator, you need to become comfortable on issuing Linux commands in a shell, and use resources to quickly learn how to properly formulate Linux commands...

You can run the following online tutorials to practice (refresh) issuing Linux commands. These tutorials were designed for another course called "OPS435", but you can still use them for practice. Simply open a shell, SSH into the Matrix server (eg. ssh yourusername@matrix.senecac.on.ca) and run the following 4 tutorials (you can copy and paste these separate pathnames and run like a program):

/home/ops435/tutorials/tutorial1
/home/ops435/tutorials/tutorial2
/home/ops435/tutorials/tutorial3
/home/ops435/tutorials/vi-tutorial


You can also refer to the section above called Linux Command Online Reference to see how use use the following Linux commands to obtain the required information.
  1. To check the network configuration settings obtained from the DHCP server, run the following commands, describing the output in your log book:
    • ifconfig
    • route
    • nslookup (at the > prompt, enter the word "server" (do not type the quotes) and record the output. Type exit to leave nslookup).

  2. Find the following information in the output of the above commands:
    • MAC address (physical or hardware address) of the ethernet network interface
    • Subnet mask
    • The IP address (logical address) assigned by the DHCP server
    • The default route (gateway)
    • The DNS nameserver

Answer the Investigation 3 observations / questions in your lab log book.

Investigation 4: SELinux

Important.png
SELinux
SELinux stands for Security-Enhanced Linux. It is a component that helps to better secure the system to protect against intrusion (hackers). Usually, SELinux is enabled upon the default install of Fedora. SELinux can be a good thing, if you take care of it and are aware that it is enabled or disabled. It is recommended that you disable SELinux by default for this course, since you will be communicating with other virtual machines and can cause machines NOT to communicate.
  1. Disabling SELinux on Fedora is actually quite simple, just edit the file /etc/selinux/config and change the following line to look like this:
    • SELINUX=disabled

Completing the Lab

Check off the following items before asking your instructor to check your lab:

  • Task 1 - Install GNU/Linux Workstation using Fedora
  • Task 2 - Collect system information after installation.
  • Task 3 - Fedora Updated
  • Task 4 - Collect network information

Arrange evidence for each of these items on your screen, then ask your instructor to review them and sign off on the lab's completion:

  • Can login with your "learn" account name
  • Has the package count
  • Has correct size partitions for:
  • root / (20GB), /home (30GB), swap (8GB)
  • /var/lib/libvirt/images (100GB)
  • Hint: Can issue lsblk (listblock command)
  • Has the correct IP address and MAC address
  • Find out the default route (gateway)
  • IP of the DNS name server
  • Name and contact information on your disk pack
  • Lag Logbook (lab1) notes filled-in.

Preparing for Quizzes

  1. How many packages were installed?
  2. How many files (correct to the nearest hundred) were installed?
  3. How many users were created automatically on your system (do not count your learn account)?
  4. What is your learn account's UID and GID?
  5. What is your learn account's home directory?
  6. What is the home directory for the user "root"?
  7. How do you determine the host name of your GNU/Linux workstation?
  8. What command can display the NIC's MAC address?