Many authors have provided Enable Sysadmin readers with reasons for building a home lab environment or guidance on creating lab environments using virsh, Ansible, and even containers. So, now that you know a home lab is good for you and you've used the articles to construct a great setup, what's next?
When I teach, I provide my students with a self-paced lab workbook that offers suggested skills in a logical order that they can use to enhance their Linux knowledge or prepare for certification exams. I've modified that workbook for this article to give you 13 things to do with your shiny new Linux lab environment.
This is an immense set of guidelines. Furthermore, there are no step-by-step instructions. In fact, that's the point. You must research and teach yourself these tasks if you don't already know how to accomplish them—just like in the real world.
There are Enable Sysadmin articles that cover some of the tasks. The lesson is not that you must know all these answers, but that you must know how to find all these answers. You don't have to do every section, though some do rely on others.
1. Choose Linux
A home lab can serve many purposes, and you need some idea of what you want to use your lab to achieve.
- If you're just exploring what's possible on Linux, installing CentOS Stream or Fedora offers you a flexible environment. You can install either of these distributions on a spare computer, a Raspberry Pi, or as a virtual machine (VM) or container.
- If you want your journey to begin at its destination, you can install Red Hat Enterprise Linux (RHEL) on a supported platform. This gets you started with enterprise-quality Linux, which means that once you perfect your setup, it's ready to migrate into production.
All these distributions derive from Fedora, so the installation process is basically the same regardless which you choose. You can follow our introductory guide if you're not sure how to start. Use this information to select the distributions to install in the next task and to better understand the Linux landscape.
2. Install at least three distributions
- Create separate boot, var, home, swap, and filesystem root partitions (five partitions total). Leave at least 100MB of empty, unused, unpartitioned hard disk space for a future task.
- Choose whatever desktop graphical user interfaces (GUIs) are available for your selected distributions.
- Create a user during installation, and make that user the administrator. This grants the user
sudo
permissions. - Once installation is complete, explore the built-in help features:
- Use man pages to research the
fstab
file. - What are the differences between the various man page sections? Admins primarily use sections 1, 5, and 8—why?
- How can you do a keyword search within man pages?
- What can be found at
/usr/share/doc
? - Explore whatever GUI help files might be available.
- Use man pages to research the
- Complete the Vim tutorial (the command is
vimtutor
) to get comfortable with Vim. You can use Nano if you prefer. Be certain you can create, open, edit, save, and close configuration files before proceeding any further with these activities. - Try configuring the installations for a specific time zone by using the
tzselect
command. - Select one installation as your primary lab computer. Designate it as the "server" and select a second installation as a "client." You will use these two systems in the remaining activities.
[ Always keep the Linux commands cheat sheet close at hand while you're learning and working. ]
3. Adjust user permissions
- Log in using the user account you created during installation. Use the
sudo
command to gain root privileges when you need to perform systemwide administrative tasks. This is an important best practice in Linux administration. - Adjust the privileges assigned to your user account by using the
sudo
command. You need to edit the/etc/sudoers
file by using thevisudo
command.
4. Use text editors
- Create a certification study plan by using Vim. List tasks that you intend to accomplish as part of your Linux skill development.
- List three (or more) resources by using the Nano text editor.
- List three Linux skills you are confident in and three Linux skills you are not confident in using a GUI text editor. This should be the only time you use a GUI editor during this entire activity.
5. Manage users and groups
- Use the
/etc/skel
directory to define profile settings before adding any user accounts. - Set password and account expirations using the
/etc/login.defs
file before adding any user accounts. Use the following password requirements:- Passwords should expire after 90 days, with a five-day warning period.
- Use the command line to create five user accounts to use in later activities. You will experiment with permissions and ownership by using these accounts. Give each user a unique name but set them all with the same password (for your own sanity).
- Use the command line to create five groups based on fictitious departments: sales, marketing, human resources, IT, engineering. Place one user from above into each group.
- Delegate the ability to reboot the system to only one user by using
sudo
.
6. Manage files
- Create directories for each department (sales, marketing, human resources, IT, engineering) at the root of the filesystem.
- Configure standard Linux permissions and ownership such that each group only has access to its own departmental directories. For example, the sales group has access to the
/sales
directory but not to other departments' directories.- After completing and testing the previous step, configure ACL permissions to permit the marketing department to have read access to the
/sales
directory. - Use ACL permissions to permit one user account to have read permission to the
/IT
directory. - Configure SGID and the sticky bit on the
/marketing
directory.
- After completing and testing the previous step, configure ACL permissions to permit the marketing department to have read access to the
- Ensure that two of your existing user accounts are now members of the marketing group.
- Use each account to create one file in the
/marketing
directory. - Test whether one of those accounts can delete the file created by the other account (they should not be able to, due to the sticky bit).
- Use each account to create one file in the
- Create a file called
unchangeable.txt
, set the immutable attribute on it, and then delete the file. - Configure file links.
- Create a file named
LinksTest.txt
in the/opt
directory, and then create a hard link to it in the/tmp
directory. Use Vim to add a line of text to the file through the/opt/LinksTest.txt
path, and then display the file's contents by using the/tmp/LinksTest.txt
file path. - Create a symlink to
/tmp/LinksTest.txt
in the root user's home directory and view the file's contents. - Delete the
/tmp/LinksTest.txt
file, and then attempt to view the file's contents through the/root/LinksTest.txt
symlink.
- Create a file named
- Create 10 files in the
/tmp
directory, and then usetar
andgzip
to bundle and compress the files.- Delete the 10 original files and then restore them from your tarball.
- Use the
find
command to search for the test files in the department directories. Do this task first as the root user, then as a user who is a member of the group that owns the directory, and finally as a user who is not a member of the group that owns the directory. - At the command line only, practice mounting and unmounting ISO images.
- Copy a file from the ISO to a directory on the Linux installation.
- Configure LVM:
- Designate two sections of 50MB each of your remaining empty hard disk drive space to be physical volumes (PVs) used by LVM.
- Combine those to PVs into a single volume group, and then configure a single logical volume (LV) that is 100MB.
- Create a directory to serve as a mount point for this LV and add an entry to the
/etc/fstab
so that it is mounted during the system bootup.
[ For more test prep advice, download the Getting ready for your Red Hat remote exam eBook. ]
7. Manage software
- Use the
rpm
command to manage software:- Use the
rpm
command to inventory all installed software and redirect this inventory list into a text file. - Install an RPM package by using the
rpm
command. For example, install thezsh
package. Download the package if necessary. - Use the
rpm
command to get info on thezsh
package, and then userpm
to uninstall the package.
- Use the
- Use the
dnf
command to manage software:- Install an RPM package with the
dnf
command. For example, install theksh
package. - Use the
dnf
command to get info on theksh
package, and then usednf
to uninstall the package.
- Install an RPM package with the
- Find and download software that you must compile. Go through the process of compiling the software. (GitLab, GitHub, and Sourceforge are popular development repositories.)
- Download a piece of software that includes an MD5 checksum to verify its integrity. After the download, compare your MD5 results with the result on the website.
8. Boot to the CLI and GUI
- Configure one of your lab machines to boot to the command-line interface (CLI) using systemd, and reboot to confirm that you were successful.
- Without rebooting or changing the default settings, start the GUI by using systemd.
- Reconfigure the VM to boot to the GUI by default, and then reboot to confirm you were successful.
- Configure the VM to boot to the CLI again, and then reboot to confirm you were successful.
9. Manage hardware
- Use the following commands to document hardware information for your lab computers:
df
,du
,cat /proc/cpuinfo
,cat /proc/meminfo
,devices
,partitions
,ifconfig
,ip addr
,cat /etc/fstab
,uname –a
- Direct the output from these commands into text files (make as many text files as you wish to organize this documentation reasonably). Use both
>
and>>
to organize the data. - Redirect the
dmesg
output to a text file, and then use thegrep
utility to display any reference to "memory" or "CPU" in the file. What else does this file tell you?
10. Create scripts
- Search the internet for at least three simple scripts that seem useful to you.
- What is the purpose of using a "dot slash" (
./
) in front of a script when executing it? - What is the purpose of "sh-bang" (such as
#!/bin/bash
) at the head of a script?
- What is the purpose of using a "dot slash" (
- Use Vim to edit these scripts. Do not use a GUI editor.
- Read Jim Hall's Learn Bash article, and then download David Both's Bash scripting for sysadmins eBook.
- Create and use a backup script to back up the contents of the department directories you created earlier.
- Schedule your backup script to run hourly by using
cron
. Unconfigure this as soon as you know it works!
- Schedule your backup script to run hourly by using
- Create a free account with GitHub, and then store your scripts there to allow for version control.
[ Download the Linux cron cheat sheet. ]
11. Configure system and network services
- Document the seven layers of the OSI model (this is assumed knowledge for networking in general).
- Document the IP address and the MAC address of at least one of your Linux systems in a file called
networking.txt
in the root user's home directory. What class is this IP address? - Edit the
/etc/hosts
files on your available VMs to permit ping-by-name functionality. - If you have two or more VMs that are networked, establish SSH connectivity.
- Configure SSH for key-based authentication only.
- Set a banner message for each SSH server that lists that server's hostname. (In other words, set one VM as the admin workstation and the remaining VMs as servers, and then do all administration from the one workstation using SSH connections.) You may need to configure the firewall for SSH connectivity.
- Execute a
traceroute
to the IP address 8.8.8.8 and document the output in a file calledtraceroutegoogle.txt
stored in the root user's home directory. Repeat the process using thetracepath
command. - Configure one VM as a DHCP server with a static IP address and the other as a DHCP client.
- Use
ping
to verify connectivity between the two VMs.
- Use
- Open ports in the firewall for any network services you test in this section, including HTTP and FTP.
- Use the
firewall-cmd
command to manage the firewalld service. Your distribution may use a different firewall service, so use the appropriate commands.
- Use the
- Install and enable Apache webserver (the process for Apache is called
httpd
).- Configure Apache to start up automatically in the
multi-user.target
and thegraphical.target
configurations. - Create a test website hosted on one of your VMs. You will need to create an
index.html
web page. Verify the website is available from your other VM. - Use a combination of
ps
andgrep
to display process information about the Apache (httpd
) process.
- Configure Apache to start up automatically in the
- Install and configure the vsFTPd server solution, and set the vsFTPd service to start automatically.
- Make a test FTP site available and verify you can download a file from it.
- View the rsyslog log files for the above HTTP and FTP services.
- Customize the GRUB2 menu file so that your distribution reads "MyLinuxDistro" in the boot menu, rather than the default menu entry (which normally displays the distro's official name specified by the vendor).
- Use the
top
command to renice a process. - Redirect the output of the
systemd-analyze
command to a text file, and then note which three services are taking the longest to start up. - Review the contents of the
/proc/cpuinfo
file, and document the model name of your CPU. - Review the contents of the
/proc/meminfo
file, and document the total amount of memory in the system.
12. Recover a forgotten root password
- Reset the root user's password by interrupting the GRUB2 startup process. Time yourself—how long did it take to exploit this configuration? This doesn't work if you've installed Linux with full-disk encryption, so if you're able to do this task, it's time to enable encryption!
13. Investigate the GUI
- Explore the various GUIs that are available with different distributions. These vary depending on what distributions you're using and what installation options you choose. Find features within the various GUIs that would be familiar or useful at work and home.
- Consider how you use your personal computer. Are there open source applications that run on Linux that would be useful? For example, musicians often use recording software—what software is available in Linux for that purpose? Or how about gaming? Digital photography and image editing?
- Read the descriptions online for various Fedora Spins.
Wrap up
These are merely suggestions. Add tasks from your exam objectives list, job descriptions, study guides, and other resources to ensure you are fully prepared for whatever is likely to come your way. I recognize that this is a huge task list. Approach it the same way you would eat an elephant—one bite at a time.