
Mastering Linux Administration
By :

This section serves as a quick guide for the basic installation of an arbitrary Linux distribution. For hands-on examples and specific guidelines, we use Ubuntu and CentOS. We also take a brief look at different environments hosting a Linux installation. There is an emerging trend of hybrid cloud infrastructures, with a mix of on-premises data center and public cloud deployments, where a Linux host can either be a bare-metal system, a hypervisor, a VM, or a Docker container.
In most of these cases, the same principles apply when performing a Linux installation. For Docker containerized Linux deployments, we reserve a separate chapter.
Here are the essential steps usually required for a Linux installation.
We start by downloading our Linux distribution of choice. Most distributions are typically available in ISO format on the distribution's website. For example, we can download Ubuntu Desktop at https://ubuntu.com/download/desktop, or CentOS at https://www.centos.org/download/.
Using the ISO image, we can create the bootable media required for the Linux installation. We can also use the ISO image to install Linux in a VM (see the Linux in a VM section).
If we install Linux on a PC desktop or workstation (bare-metal) system, the bootable Linux media is generally a CD/DVD or a USB device. With a DVD writeable optical drive at hand, we can simply burn a DVD with our Linux distribution ISO. But, as modern-day computers, especially laptops, rarely come equipped with a CD or a DVD unit of any kind, the more common choice for a bootable media is a USB drive.
There's also a third possibility of using a so-called PXE boot server. PXE (pronounced pixie) stands for Preboot eXecution Environment, which is a client-server environment where a PXE-enabled client (PC/BIOS) loads and boots a software package over a local or wide area network from a PXE-enabled server. PXE eliminates the need for physical boot devices (CD/DVD, USB) and reduces the installation overhead, especially for a large number of clients and operating systems. Probing the depths of PXE internals is beyond the scope of this chapter. A good starting point to learn more about PXE is https://en.wikipedia.org/wiki/Preboot_Execution_Environment.
A relatively straightforward way to produce a bootable USB drive with a Linux distribution of our choice is to use the open source tool UNetbootin (https://unetbootin.github.io). UNetbootin is a cross-platform utility, running on Windows, Linux, and macOS:
Figure 1.2 – Creating a bootable USB drive with UNetbootin
Here are the steps for creating a bootable USB drive with Ubuntu Desktop using UNetbootin. We assume the Ubuntu Desktop ISO image has been downloaded and UNetbootin is installed (in our case on macOS):
Ubuntu
).20.04
).ISO
).ubuntu-20.04-live-server-amd64.iso
).USB
)./dev/disk2s2
)Now, let's look at how we can take the bootable media for a spin.
This step is optional.
Most Linux distributions have their ISO image available for download as live media. Once we have the bootable media created with our Linux distribution of choice, we can run a live environment of our Linux platform without actually installing it. In other words, we can evaluate and test the Linux distribution before deciding whether we want to install it. The live Linux operating system is loaded in the system memory (RAM) of our PC, without using any disk storage. We should make sure the PC has enough RAM to accommodate the minimum required memory of our Linux distribution.
We can run Linux in live mode in either of the following ways:
When booting the PC from a bootable media, we need to make sure the boot order in the BIOS is set to read our drive with the highest priority. On a Mac, we need to press the Option key immediately after the reboot start up chime and select our USB drive to boot from.
Upon reboot, the first splash screen of our Linux distribution should provide the option of running in live mode, as seen in the following illustration for Ubuntu Desktop (Try Ubuntu):
Figure 1.3 – Choosing live mode for Ubuntu
Next, let's take a look at the installation procedure of our Linux distro, using the bootable media.
We start the installation of our Linux distribution by booting the PC from the bootable media previously created. To ensure the system can boot from our drive (DVD or USB), we are sometimes required to change the boot order in the BIOS, especially if we boot from a USB drive. Most of the time, entering a system BIOS on a PC or laptop computer is done by pressing a Function key (or even the Delete key) immediately after powering on or restarting the machine. This key is usually mentioned at the bottom of the initial bootup screen.
In the following sections, we showcase the installation process of Ubuntu and CentOS using their ISO images. We choose the Desktop and Server versions for Ubuntu and highlight the main differences. CentOS comes in a single flavor, in essence, a server platform with an optional graphical user interface.
In each of the Linux installation sections, we also provide a brief guide on how to prepare a VM environment for the related Linux platform.
A VM is an isolated software abstraction of a physical machine. VMs are deployed on top of a hypervisor. A hypervisor provides the runtime provisioning and resource management of VMs. For the simple illustration of Linux VM installations, in this section, we limit ourselves to a couple of general-purpose hypervisors:
Both these hypervisors are cross-platform virtualization applications, and they run on Intel or AMD processor architectures on Windows, Linux, and macOS.
The difference between installing Linux on a VM compared to a physical machine is minor. The notable distinction is related to the VM sizing and configuration steps, making sure that the minimum system requirements of the Linux distribution are met.
In this section, we briefly illustrate the installation of Ubuntu Server LTS. If we plan to install Ubuntu in a VM, there are some preliminary steps required for provisioning the VM environment. Otherwise, we proceed directly to the Installation section.
In the following steps, we will create a VM based on Ubuntu Server—using VMware Workstation on macOS:
Figure 1.4 – Creating a new VM based on the Ubuntu ISO image
Let's look at the steps:
Figure 1.5 – Customizing the VM settings
Figure 1.6 – Customizing the VM disk size
The remaining part of the Linux VM installation is identical to standard physical machine installation, shown in the following sections.
Here's the normal installation process for Ubuntu Server LTS, following the initial boot into setup mode:
Packt
), a server name (neptune
), a username (packt
), and the password (Figure 1.7):Figure 1.7 – Setting up the server profile
Figure 1.8 – Enabling the OpenSSH server
microk8s
, docker
, and aws-cli
):Figure 1.9 – Enabling additional software packages
After the system reboot, the login screen appears. We have completed the Ubuntu Server installation.
Next, let's take a look at a similar installation procedure, this time with the CentOS Linux distribution.
In this section, we briefly illustrate the installation of CentOS. If we plan to install CentOS in a VM, there are some preliminary steps required for provisioning the VM environment. Otherwise, we proceed directly with the Installation section.
In the following steps, we show the setup of a CentOS VM using Oracle VM VirtualBox on macOS. The choice of VirtualBox over VMware Workstation (used in the previous section with Ubuntu Server) is simply for showcasing the use of an alternative hypervisor:
a) Hostname and operating system (jupiter, CentOS Red Hat, 64-bit)
b) Memory size (4 GB)
c) Hard disk size (30 GB)
d) Hard disk file type (VDI VirtualBox Disk Image)
e) Storage on the physical hard disk (dynamically allocated)
f) File location and size (path to .vdi file, 30 GB)
Figure 1.10 – VirtualBox VM configuration
Figure 1.11 – Virtual Box VM storage settings
At this stage, starting the VM initiates the CentOS installation.
Here's the normal installation process for CentOS, following the initial boot into setup mode:
Figure 1.12 – The CentOS welcome screen
a) Language support and localization (English, US)
b) Software selection (Server with GUI)
c) Device selection and storage configuration (Local media)
The following screenshot summarizes all this. The settings mostly reflect default values (Figure 1.13):
Figure 1.13 – The CentOS installation summary
Figure 1.14 – The CentOS user settings
Figure 1.15 – Rebooting CentOS after installation
So far, we have learned how to perform a basic installation for two of the most common Linux distributions, Ubuntu and CentOS. Along the way, we created a bootable USB flash drive for our installation media, most commonly used for Linux PC platform installations. For both Linux distros, we briefly covered VM-specific Linux environments using the VMware Workstation and Oracle VM VirtualBox hypervisors.
In the following section, we'll learn how to install and run a Linux distribution on a Windows platform without the use of a standalone hypervisor.
Change the font size
Change margin width
Change background colour