Red Hat Enterprise Linux (RHEL) is the most popular Linux distribution, and chances are that you'll install it many times during your Linux career. Gaining experience with this distro's installation process will help you become a Linux expert. If you read through Chapter 2, “Installing an Ubuntu Server,” some items within the installation steps will feel familiar. However, there are enough differences between installing the two Linux distributions that you can get tripped up.
Therefore, our goal in this chapter is to assist you through your first installation of a RHEL distribution. We'll provide step‐by‐step guidance, help you avoid pitfalls, and ultimately build your sysadmin skillset.
Pre‐Installation Requirements
Before taking a look at the needed resources, we need to have a chat about fees associated with RHEL. This particular distribution requires you to pay money to use it. For example, every year it would cost you about $350 to potentially more than $1,300 per system to run RHEL on a server. This is expensive if you just want a Linux distribution to work with for learning purposes! But don't give up hope, because we've got a free solution for you. The CentOS Linux distribution is free of charge and is a community‐supported version of RHEL. For learning purposes, it will work perfectly for you!
For our purposes in this book, the CentOS distribution without a GUI will provide what is needed since our target is a headless server (see Chapter 2 for a more detailed explanation as to why a GUI is typically not used in modern server rooms). Specifically, we're using a CentOS 8 Linux distribution.
Before starting your CentOS installation, it's a good idea to review what resources are needed. This step is important in order to achieve a successful Linux distribution installation.
You may perform the CentOS installation on a physical system, or you may install it as a virtual machine on a host system. Thus, in the next few sections, we'll look at the hardware requirements needed for installing the CentOS distribution directly on a physical server and for installing it within a virtualized environment.
Hardware Requirements
If you plan on installing the CentOS 8 distribution directly on a headless server, your computer must support a 64‐bit processor architecture. Here is a list of a few that will work well:
AMD amd64
ARM64 (not supported by RHEL)
Intel amd64
POWER9 (not supported by RHEL)
Besides having the proper processor on your system, you need to have enough resources available to avoid a sluggish system. Table 4.1 shows the recommended resources to support a well‐running CentOS distro.
TABLE 4.1: Recommended Server Resources for CentOS Distribution
RESOURCE
MINIMUM
RECOMMENDED
CPU
1.8 GHz
2 or more GHz
Memory
2 GB
2 GB per logical CPU
Disk space
10 GB
20 or more GB
Notice the “per logical CPU” tag in the recommended memory. This is because CentOS can support some rather powerful CPUs, and it treats every core (or thread) in a multicore (or thread) processor as a logical CPU. So if you have a dual‐core processor, it is recommended that you have 4 GB of RAM on your system, while a quad‐core processor needs 8 GB of memory.
Also, keep in mind that these recommendations are only for the operating system. Increase these resources to meet the needs of the application(s) you will run on the server.
If you don't have access to a physical server, you can set up a virtual environment on a laptop or an old desktop. Using a virtualized system on your laptop provides a great deal of flexibility. Wherever you go with your laptop, you can learn about Linux.
Virtual Server Requirements
If you plan on running the CentOS distribution as a virtual machine (VM), you need to ensure that the host machine's operating system is supported by the hypervisor.
For this book, we're focusing on the Oracle VirtualBox hypervisor software. Here are a few of the operating systems on which it can run:
Windows 8.1
Windows 10
macOS High Sierra
Ubuntu 18.04LTS
This list is always evolving. Thus, it's a good idea to visit the Oracle VirtualBox manual website, virtualbox.org/manual, and view the currently supported host operating systems.
Running a virtualized environment will increase the needed resources on your system. You'll need to make sure that the host machine can handle not only the hypervisor, but the CentOS VM as well. Table 4.2 lists the recommended host machine resources for a virtualized CentOS server.
TABLE 4.2: Recommended Host Machine Resources for a CentOS VM
RESOURCE
MINIMUM
RECOMMENDED
CPU
2 GHz dual core
2 or more GHz dual core
Memory
4 GB
16 or more GB
Free disk space
25 GB
30 or more GB
These resource recommendations are guidelines, not rules. Thus, you may need slightly more resources or get by with a fewer. Also, these recommendations assume you are running only one VM at a time. You'll need more resources on your system if you plan on running multiple VMs at the same time or running a VM along with several other apps.
After you have the right level of resources on your host system, you're ready to start downloading the needed software. We'll cover this in the next section.
Finding the Software
After you determine that you have the appropriate resources, but before you start the installation process, you need to have the proper software. You'll want to make sure that you get the correct version and type. For the larger software files, it's also critical to verify that no corruption has occurred when the software was downloaded. If you have a corrupt software file, you'll end up needlessly wasting your time or, worse, delaying the completion of an important installation project.
Oracle VirtualBox
We recommend that you use Oracle VirtualBox as the hypervisor on your system. If you did not download this software when you read Chapter 2, you can now download the latest version of this software from virtualbox.org.
It is important that you get the correct platform package of VirtualBox. You'll see a list of potential host systems on the VirtualBox website, such as the following:
Windows
macOS
Linux
Make sure to select the VirtualBox package for the system on which the CentOS virtual machine will be running. Often, people make an incorrect choice because they confuse the host system with the virtual machine. Here's an example that may help: if you have a laptop running Windows where you plan on installing CentOS as a VM, then Windows is the host, and you'll want to download the VirtualBox package for Windows. Our examples in this chapter are based on a Windows 10 host system.
CentOS
To install CentOS as a VM, besides the hypervisor software (and the correct amount of resources on the host machine), you need a CentOS ISO image file.
To find the needed CentOS ISO image file, first go to the website:
centos.org/download/. The type of processor you have will determine your next step. Click the appropriate CPU type for your processor under the CentOS Linux section, shown in Figure 4.1.
A new browser window will appear, allowing you to select from several sites to start the download process. You can click any of the sites. Once you do, you should get a window similar to what is shown in Figure 4.2.
Click the CentOS‐8*boot.iso link to start the download of the CentOS ISO image file. Depending on the web browser you are using, you may have to deal with some pop‐up windows that want to confirm it is OK to download this file. You'll most likely want to keep this website open or bookmark it in your browser, because we use the checksum information provided here soon.
It's important to verify that no corruption occurred while the ISO file was downloading. To do this, we'll use hashing.
While you work your way through the following exercise, you may find you have a corrupted CentOS ISO image file. If this is the case, you'll need to re‐download the file and check it via hashing again.
Verifying that the CentOS ISO image file is a good copy will save you time. If you tried to use a corrupt image file in an installation, it may work partway through the process and then quit before completion. That's frustrating. It's always best to check that your ISO image file is good before proceeding within an install.
Now that you've verified your copy of the CentOS ISO image file and have downloaded the Oracle VirtualBox hypervisor software, you're ready to start the installation. We'll cover that process next.
Running the Installation
To create a CentOS VM, you'll need to first install the hypervisor, Oracle VirtualBox. Once that software is up and running, you can set up and install CentOS as a VM using its ISO image file and the hypervisor.
Oracle VirtualBox
The Oracle VirtualBox hypervisor software will allow you to do much more than set up CentOS as a Linux VM. You can also install another version of Windows within a VM and use it to try features or configurations you normally wouldn't do on your main system.
If you need to take a break, close out the VirtualBox interface window by clicking the X in the upper‐right corner. However, if you want to plow ahead, keep it open. We'll launch into installing CentOS in the next section.
CentOS
Installing the CentOS as a VM may feel overwhelming the first time you do it, and there are a few tricky items to negotiate along the way. We'll help you through this initial instance to build your confidence and help you avoid potential pitfalls.
Your hard work is about to pay off. You are now ready to install the CentOS distribution on the virtual machine you just configured within VirtualBox.
Congratulations! You've installed CentOS as a VM within the VirtualBox hypervisor, and you can use this Red Hat distribution twin to learn more about RHEL. Now that the installation process is complete, it's a good idea to check and make sure everything is OK. We'll cover that next.
Checking the Installation
Though the system may appear fine after an initial installation, it's wise to perform a few checks. While it's a little difficult to understand everything you are looking at in this section, reviewing this information will help you as we cover these utilities and concepts in detail later in the book. Also, you can return to this section for guidance the next time you perform a CentOS distribution installation.
First, boot your CentOS Server VM. After the system has booted, log into the terminal using the root account name and password, and do the following:
Check for boot errors. There are three commands that can help you check for boot errors. The first is dmesg, and to view this information, you don't need super user privileges. This will display the kernel ring buffer, but that data is useful only if you check it soon after the system has booted.
To see boot messages long after a system boot, type less /var/log/boot.log at the prompt and press Enter. You can move forward through this log by pressing the spacebar. When you are done looking at the information, press the Q key to exit to the command‐line prompt.
You can look for boot errors and all kinds of messages via the journalctl command. To peruse this information, you will also need the spacebar to move forward and the Q key to quit your viewing.
Determine the default boot level. The default boot level on a Linux system determines what applications are started when the system boots. The command to see this information is systemctl get‐default. It does not require super user privileges to use.
Most likely, you will see multi‐user.target when you issue this command, meaning that even if GUI software is available, the GUI will not start on boot. You'll learn more about targets later in this book.
Check version information. Determining the version numbers of the system's main components is helpful when tracking down problems. First, make sure you have the right CentOS distribution version installed by typing cat /etc/redhat‐release at the prompt. The distribution name and version is displayed.
Check the Linux kernel version too. This is important to know because different features (and bugs!) exist in the various kernel versions. To see this information, you'll need to type uname ‐r at the command‐line prompt. You can also view this information via the cat /proc/version command.
Finally, look at the version of the Bash Shell running on the system. This is easy to accomplish by using the bash ‐‐version command.
Once you've completed your checks, celebrate! You worked hard to get this CentOS distribution installed correctly.
The Bottom Line
Review needed CentOS hardware resources. Determining the hardware resources required for a CentOS installation on a physical or virtualized server helps to ensure a successful completion of the install. It also avoids important project delays due to under‐resourced systems.
Master It Imagine that you need to install the CentOS distribution on a physical server that has a dual‐core 2 GHz CPU, 200 GB hard drive, and 2 GB of RAM. Are the server's resources at the recommended level? Why or why not?
Determine the requirements for a virtual CentOS system. Installing the CentOS distribution as a VM on a host system has different requirements than a direct installation on a physical server. It is critical to evaluate the host system so that the installation is successful.
Master It Your project team is planning on installing two CentOS VMs on a host system that has a quad‐core 2.8 GHz CPU, 200 GB of free disk space, and 32 GB of RAM. Are the host system resources sufficient? Why or why not?
Obtain CentOS software. To install the CentOS Linux distribution, you must have the proper ISO image file. This is true whether you are installing it directly on hardware or as a VM. Besides getting the ISO file, you need to ensure that it is not corrupted so that the installation proceeds well.
Master It You've downloaded the CentOS ISO image file, but you are concerned that during the download process, file corruption occurred. What should you do to see whether the ISO image file is corrupt?
Conduct an installation of a CentOS distribution. There are several steps to successfully install a CentOS distribution, and it is critical to make sure you complete all of them. Skipping a step can cause problems immediately as well as problems later, if you can even get the system to boot.
Master It Your sysadmin team has correctly installed the CentOS software from the ISO image file, and the system booted without any problems. What's the next step?
Audit the CentOS distribution's installation. If you had some problems while booting the system, there are a few commands you can use to look at helpful boot messages. But even a successful installation still requires a few additional checks.
Master It At your company, you have completed the entire CentOS distro installation process on a new system without any problems, but you then ran into issues the last time the server was rebooted. You need to review the boot messages to track down the problem(s). What log file can you use to view these messages?