Linux Chapter 6
Linux Chapter 6
Hands-On Projects
These projects should be completed in the order given. The hands-on projects
presented in this chapter should take a total of three hours to complete. The
The ISO image for Ubuntu Server 18.04 installation media (ubuntu-
18.04.1-live-server-amd64.iso)
The ISO image for Ubuntu Server 14.04 LTS installation media (ubuntu-
14.04.5-server-amd64.iso)
Project 6-1
In this hands-on project, you install Ubuntu Server 18.04 Linux within a virtual
machine on a Windows computer and examine the LVM partition
configuration afterwards.
In your virtualization software, create a new virtual machine
1
called Ubuntu Server 18 that has the following characteristics:
a. 2GB of memory
d. The virtual machine DVD drive attached to the ISO file for
the Ubuntu Server 18.04 installation media (ubuntu-
18.04.1-live-server-amd64.iso)
Note
The Ubuntu Server Linux installation program does not use a graphical
desktop. As a result, you must switch between buttons shown on the
screen using the Tab key and then press Enter to make your selections.
English (US).
At the Ubuntu 18.04 welcome screen, examine the options. Note
5
that Ubuntu allows you the option to install in a small footprint
326
At the Network connections screen, note that your network
6
interface is set to obtain an IP address from a DHCP server by
default and select Done.
c. Username = user1
d. Password = LINUXrocks!
After the system has booted, note that a graphical login is not
13
available. Log into tty1 as user1 with the password LINUXrocks!.
At the command prompt, type sudo passwd root and press Enter
14
to set the root user password. When prompted, enter your
prompted.
At the command prompt, type the following commands in turn
16
and press Enter. Examine the output of each one:
a. df -hT
b. fdisk -l
c. lvdisplay
d. lsblk
e. blkid
f. ls -l /dev/disk/by-uuid
g. ls -l /dev/disk/by-partuuid
h. ls -l /dev/disk/by-id
i. ls -l /dev/disk/by-path
j. cat /etc/fstab
327
Type exit and press Enter to log out of your shell.
17
Project 6-2
In this hands-on project, you add hard disks to your Ubuntu Server 18 virtual
machine, configure a software RAID 5 volume, and simulate a hard disk failure
and recovery. At the end of this project, you will remove your RAID
configuration.
After your Ubuntu Server 18 virtual machine has booted, log into
3
the command-line terminal (tty1) using the user name of root and
the password of LINUXrocks!.
At the command prompt, type lsblk and press Enter. Note that the
4
names of the additional disk devices are sdb, sdc, sdd, and sde.
328
At the command prompt, type cp /etc/hosts /data and press Enter.
11
Next, type ls -F /data and press Enter to verify that the hosts file
was copied to your filesystem. What other directory was created
on this filesystem and why?
At the command prompt, type df -hT and press Enter. What is the
12
total size of your RAID 5 volume? Why is it not 4GB (4 x 1GB
disks)?
At the command prompt, type lsblk and press Enter. Note the md0
13
device associations for each of your disks. Next, type blkid and
press Enter. Does /dev/md0 have a filesystem UUID that can be
used within /etc/fstab to automount the RAID volume at boot time?
Type ls -F /data and press Enter. Are your files still available and
16
accessible? Why?
At the command prompt, type mdadm --manage /dev/md0 -r
17
/dev/sdc and press Enter to remove the /dev/sdc device from the
RAID volume. In a production environment, this is when you
would physically remove the hard disk from the server and
replace it with a working one.
Project 6-3
In this hands-on project, you install and configure the ZFS filesystem on your
Ubuntu Server 18 virtual machine. At the end of this project, you will remove
your ZFS configuration.
329
At the command prompt, type the following commands (in order)
2
to add software repositories and install ZFS support on your
Ubuntu system:
a. apt-get update
b. add-apt-repository main
c. add-apt-repository restricted
d. add-apt-repository universe
e. add-apt-repository multiverse
Note
Ubuntu Server Linux uses a different package manager than Fedora Linux.
The apt-get command is functionally equivalent to the dnf command that
At the command prompt, type df -hT and press Enter. Note that
4
the data ZFS volume was mounted to /data automatically. Next,
type lsblk at the command prompt and press Enter. Note that ZFS
created a single partition for the data (/dev/sdb1) as well as a
At the command prompt, type zpool destroy data and press Enter
6
to remove the data volume.
zpool status data at the command prompt and press Enter. Does
your mirror have any problems listed?
330
At the command prompt, type zpool detach data /dev/sdb and
10
press Enter to remove the bad disk (/dev/sdb) from the mirror.
Type zpool status data at the command prompt and press Enter
to verify that it is no longer listed.
mkdir /data/webstorage
mkdir /data/databases
mkdir /data/filestorage
At the command prompt, type zfs list and press Enter. Are the
15
webstorage, databases, and filestorage directories listed? Why?
Next, type each of the following commands in turn and press Enter
to create three subfilesystems for each of these directories:
At the command prompt, type zfs list and press Enter. Are the
16
webstorage, databases, and filestorage directories listed? Why?
At the command prompt, type zpool destroy data and press Enter
18
to remove the data volume.
At the command prompt, type fdisk /dev/sdb and press Enter.
19
Next, type d and press Enter and Enter again to delete the ZFS
configuration partition. Next, type d and press Enter to delete the
ZFS data partition. Finally, type w and press Enter to save your
changes. Repeat this step three more times for /dev/sdc, /dev/sdd,
and /dev/sde.
331
Type exit and press Enter to log out of your shell.
20
Project 6-4
In this hands-on project, you configure the BTRFS filesystem on your Ubuntu
Server 18 virtual machine. At the end of this project, you will remove your
BTRFS configuration.
At the command prompt, type df -hT and press Enter. Note that
6
the volume size is 4GB. Next, type btrfs filesystem df /data and
press Enter. Note the output.
a. df -hT
b. lsblk
Next, type umount /data and press Enter to unmount your BTRFS
15
volume.
a. df -hT
b. lsblk
Next, type umount /data and press Enter to unmount your BTRFS
19
volume.
Project 6-5
In this hands-on project, you examine installation log files and system
information on your Ubuntu Server 18 virtual machine.
333
At the command prompt, type ls –F /proc and press Enter to view
3
the file and directory contents of the proc filesystem.
334
At the command prompt, type journalctl –b | less and press
15
Enter. How does the information compare to the previous step?
Type q to quit the less utility.
Type poweroff and press Enter to power off your Ubuntu Server
16
18 virtual machine.
Project 6-6
In this hands-on project, you use system rescue on your Fedora Linux virtual
machine using your live installation media to check your root filesystem for
errors and change the root user’s password.
At the command prompt, type mount -t proc proc /proc and press
9
Enter to mount the /proc filesystem.
Click the power icon in the upper-right corner, select the power
12
icon that appears, and click Power Off to shut down your Fedora
Live installation image.
In the Settings for your virtual machine in your virtualization
13
software, ensure that the DVD drive is no longer attached to the
Fedora ISO image.
335
At the command prompt, type passwd root and press Enter.
15
Supply a new root user password of LINUXrocks! and press Enter
when prompted (twice).
Project 6-7
In this hands-on project, you install Ubuntu Server 14.04 LTS Linux within a
virtual machine on a Windows computer and examine the LVM partition
configuration afterwards.
In your virtualization software, create a new virtual machine
1
called Ubuntu Server 14 that has the following characteristics:
a. 2GB of memory
d. The virtual machine DVD drive attached to the ISO file for
the Ubuntu Server 14.04 installation media (ubuntu-
14.04.5-server-amd64.iso)
At the Configure the keyboard screen, select Yes and press Enter.
7
Follow the prompts to complete the detection. When the detection
process finds a “us” keyboard layout, select Continue and press
Enter.
At the Configure the network screen, type a hostname of
8
Ubuntu14 , select Continue, and press Enter.
At the Set up users and passwords page, type user1 as the full user
9
name, select Continue, and press Enter. When prompted for the
simple user name, ensure that user1 is displayed, select Continue,
and press Enter. When prompted for a password for user1, type
LINUXrocks! , select Continue, and press Enter. When prompted
to repeat the password, enter LINUXrocks! again, select
Continue, and press Enter. When prompted to encrypt user1’s
home directory, ensure that No is selected and press Enter.
At the Configure the clock screen, ensure that the correct time
10
zone is displayed, select Yes, and press Enter. Alternatively, if an
incorrect time zone is displayed, select No, press Enter, select your
time zone, and press Enter.
336
At the summary screen, note that Ubuntu will create an LV for the
12
root filesystem with an ext4 filesystem and an LV for swap as well.
Select Yes and press Enter to write the changes to the disk and
start the installation of the core system packages.
At the Install the GRUB boot loader on a hard disk screen, ensure
19
that Yes is selected and press Enter.
After the system has booted, log into tty1 as user1 with the
21
password LINUXrocks!. At the command prompt, type who and
press Enter.
At the command prompt, type sudo passwd root and press Enter.
22
Supply user1’s password of LINUXrocks! when prompted and
press Enter. Supply a password of LINUXrocks! for the root user
when prompted and press Enter. Confirm the root user password
by typing LINUXrocks! and press Enter.
At the command prompt, type lsblk and press Enter. Examine the
24
output. Why was a /boot partition created on your hard disk? Is
the / (root) filesystem a volume managed by the LVM?
At the command prompt, type fdisk -l and press Enter. Note that
25
the remainder of the drive is an extended partition (/dev/sda2)
that contains a single logical drive (/dev/sda5) used exclusively by
the LVM.
At the command prompt, type lvdisplay and press Enter. Note the
26
logical volumes created for the root filesystem and swap partition
within the Ubuntu14-vg volume group.
Discovery Exercises
Perform the same project using your Fedora Linux virtual machine,
a. 4GB of memory
c. The virtual machine DVD drive attached to the ISO file for
Fedora 28 live media (Fedora-Workstation-Live-x86_64-28-
1.1.iso)
filesystem that uses BTRFS RAID 1 fault tolerance for both data and
this during the Fedora installation program, you will need to choose
the Advanced Custom (Blivet-GUI) option on the Installation
Destination screen. Also note that the /boot filesystem cannot use
4. The LVM can also be used to provide RAID for logical volumes,