Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Mastering Linux Administration
Mastering Linux Administration

Mastering Linux Administration: A comprehensive guide to installing, configuring, and maintaining Linux systems in the modern data center

Arrow left icon
Profile Icon Calcatinge Profile Icon Balog
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.4 (15 Ratings)
Paperback Jun 2021 772 pages 1st Edition
eBook
€17.99 €26.99
Paperback
€32.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Calcatinge Profile Icon Balog
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.4 (15 Ratings)
Paperback Jun 2021 772 pages 1st Edition
eBook
€17.99 €26.99
Paperback
€32.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€17.99 €26.99
Paperback
€32.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Mastering Linux Administration

Chapter 1: Installing Linux

The recent years have marked a significant rise in the adoption of Linux as the operating system of choice for both server and desktop computing platforms. From enterprise-grade servers and large-scale cloud infrastructures to individual workstations and small-factor home appliances, Linux has become an ever-present platform for a wide range of applications.

The prevalence of Linux, perhaps now more than ever, brings into the spotlight much-needed administration skills for a growing community of system administrators and developers. In this book, we take a practical approach to Linux administration essentials, with the modern-day system administrator, DevOps, or developer in mind.

In this first chapter, we'll guide you through the Linux installation process, either on physical hardware (bare metal) or using a Virtual Machine (VM). We'll take you further with a few case studies on choosing a Linux distribution based on functional requirements. Along the way, we introduce you to the Linux graphical user interface with some hands-on examples of configuring GNOME and KDE. Finally, we build a Linux workstation suitable for our daily computing needs.

Here are the topics we cover in this chapter:

  • The Linux operating system
  • Linux distributions
  • Choosing the right Linux distribution
  • Installing Linux - the basics
  • The Windows Subsystem for Linux (WSL)
  • Installing Linux graphical user interfaces
  • Setting up and using the Linux workstation

Technical requirements

We will use the following platforms and technologies in this chapter:

  • Linux distributions: Ubuntu Server, Ubuntu Desktop, CentOS
  • Linux package managers: DEB, RPM
  • VM hypervisors: Oracle VM VirtualBox, VMware Workstation
  • VM host platforms: Windows, macOS X
  • The Bash Command-Line Interface (CLI)
  • GitHub (https://github.com/)

The Linux operating system

Linux is a relatively modern operating system created in 1991 by Linus Torvalds, a Finnish computer science student at the time, from Helsinki. Originally released as a free and open source platform prohibiting commercial redistribution, Linux eventually adopted the GNU General Public Licensing (GPL) model in 1992. This move played a significant role in its wide adoption by the developer community and commercial enterprises alike.

It is important to note that the Free Software Foundation community distinctly refers to Linux operating systems (or distributions) as GNU/Linux to emphasize the importance of GNU or free software.

Initially made for Intel x86 processor-based computer architectures, Linux has since been ported to a wide variety of platforms, becoming one of the most popular operating systems currently in use.

The genesis of Linux might be considered the open source alternative of its mighty predecessor, Unix. This system was a commercial-grade operating system developed at AT&T Bell Labs research center by Ken Thompson and Dennis Ritchie in 1969.

Linux distributions

A Linux operating system is typically referred to as a distribution. A Linux distribution, or distro, is the installation bundle (usually an ISO image) of an operating system that has a collection of tools, libraries, and additional software packages installed on top of the Linux kernel.

A kernel is the core interface between a computer's hardware and its processes, controlling the communication between the two and managing the underlying resources as efficiently as possible.

The software collection bundled with the Linux kernel usually consists of a bootloader, shell, package management system, graphical user interface, and various software utilities and applications.

The following diagram is a simplified illustration of a generic Linux distribution architecture:

Figure 1.1 – Simplified view of a generic Linux architecture

Figure 1.1 – Simplified view of a generic Linux architecture

There are hundreds of Linux distributions currently available. Among the most popular are Debian, Fedora, openSUSEArch Linux, and Slackware, with many other Linux distributions either based upon or derived from them. Some of these distros are divided into commercial and community-supported platforms.

One of the key differences between Linux distributions is the package management system they use and the related Linux package format. We'll get into more detail on this topic in later chapters. For now, the focus is on choosing the right Linux distribution based on our needs.

Choosing the right Linux distribution

There are many aspects involved in choosing a Linux distribution, based on various functional requirements. A comprehensive analysis would be far beyond the scope of this chapter. However, considering a few essential points may help with making the right decision:

  • Platform: The choice between a server, a desktop, or an embedded platform is probably one of the top decisions in selecting a Linux distribution. Linux server platforms and embedded systems are usually configured with the core operating system services and essential components required for specific applications (such as networking, HTTP, FTP, SSH, and email), mainly for performance and optimization considerations. On the other hand, Linux desktop workstations are loaded (or pre-loaded) with a relatively large number of software packages, including a graphical user interface for a more user-friendly experience. Some Linux distributions come with server and desktop flavors (such as Ubuntu, Fedora, and openSUSE), but most distros have a minimal operating system, with further configuration needed (such as CentOS, and Debian). Usually, such distributions would be good candidates for Linux server platforms. There are also Linux distributions specifically designed for desktop use, such as elementary OS, Pop!_OS, or Deepin. For embedded systems, we have highly optimized Linux distros, such as Raspbian and OpenWRT, to accommodate small-form factor devices with limited hardware resources.
  • Infrastructure: Today, we see a vast array of application and server platform deployments, ranging from hardware and local (on-premises) data centers to hypervisors, containers, and cloud infrastructures. Weighing a Linux distribution against any of these types of deployments should take into consideration the resources and costs involved. For example, a multi-CPU, large-memory, and generally high-footprint Linux instance may cost more to run in the cloud or a Virtual Private Server (VPS) hosting infrastructure. Lightweight Linux distributions take fewer resources and are easier to scale in environments with containerized workloads and services (for instance, with Kubernetes and Docker). Most Linux distributions now have their cloud images available for all major public cloud providers (for instance, Amazon AWS, Microsoft Azure, and Google Compute Engine). Docker container images for various Linux distributions are available for download on Docker Hub (https://hub.docker.com). Some Docker images are larger (heavier) than others. For example, the Ubuntu Server Docker image outweighs the Alpine Linux Docker image considerably, and this may tip the balance when choosing one distribution over the other. Also, to address the relatively new shift to containerized workflows and services, some Linux distributions offer a streamlined or more optimized version of their operating system to support the underlying application infrastructure. For example, Fedora features the Fedora CoreOS (for containerized workflows) and Fedora IoT (for Internet of Things ecosystems). CentOS has the Atomic project, as a lean CentOS for running Docker containers.
  • Performance: Arguably, all Linux distributions can be tweaked to high-performance benchmarks in terms of CPU, GPU, memory, and storage. Performance should be regarded very closely with the platform and the application of choice. An email backend won't perform very well on a Raspberry Pi, while a media streaming server would do just fine (with some external storage attached). The configuration effort for tuning the performance should also be taken into consideration. CentOS, Debian, and Ubuntu all come with server and desktop versions reasonably optimized for their use. The server versions can be easily customized for a particular application or service by only limiting the software packages to those that are essential for the application. To further boost performance, some would go to the extent of recompiling a lightweight Linux distro (for instance, Gentoo) to benefit from compiler-level optimizations in the kernel for specific subsystems (for instance, the networking stack or user permissions). As with any other criteria, choosing a Linux distribution based on some application or platform performance is a balancing act, and most of the time, common Linux distros will perform exceptionally well.
  • Security: When considering security, we have to keep in mind that a system is as secure as its weakest link. An insecure application or system component would put the entire system at risk. Therefore, the security of a Linux distribution should be scrutinized in close relation to the related application and platform environment. We can talk about desktop security for a Linux distro serving as a desktop workstation, for example, with the user browsing the internet, downloading media, installing various software packages, and running different applications. The safe handling of all these operations (against malware, viruses, and intrusions) would make for a good indicator of how secure a system can be. There are Linux distros that are highly specialized in application security and isolation, well suited for desktop use: Qubes OS, Kali Linux, Whonix, Tails, and Parrot Security OS. Some of these distributions are developed for penetration testing and security research.

    On the other hand, we may consider the server security aspect of Linux server distributions. In this case, regular operating system updates with the latest repositories, packages, and components would go a long way to securing the system. Removing unused network-facing services and configuring stricter firewall rules are further steps of reducing the possible attack surface. Most Linux distributions are well equipped with the required tools and services to accommodate the preceding. Opting for a distro with frequent and stable upgrades or release cycles is generally the first prerequisite for a secure platform (for instance, Centos, RHEL, Ubuntu LTS, or SUSE Enterprise Linux).

  • Reliability: Linux distributions with aggressive release cycles and a relatively large amount of new code added in each release are usually less stable. For such distros, it's essential to choose a stable version. Fedora, for example, has rapid releases, being one of the fastest progressing Linux platforms. Yet, we should not heed myths claiming that Fedora or other similar fast-evolving Linux distros are less reliable. Don't forget, one of the most reliable Linux distributions out there, Red Hat Enterprise Linux (RHEL), is derived from Fedora.

There's no magic formula for choosing a Linux distribution. In most cases, the choice of platform (server or desktop) combined with a couple of the data points mentioned previously and some personal preferences would decide a Linux distribution. With production-grade environments, most of the previously enumerated criteria become critical, and the available options for our Linux platform of choice would be reduced to a few industry-proven solutions. In the following section, we enumerate some of the most popular Linux distributions.

Common Linux distributions

This section summarizes the most popular and common Linux distributions at the time of this writing, with emphasis on their package manager. Most of these distros are free and open source platforms. Their commercial-grade variations, if any, are noted.

CentOS and RHEL

CentOS and its derivatives use RPM as their package manager. CentOS is based on the open source Fedora project. It is suited to both servers and workstations. RHEL is a commercial-grade version of CentOS, designed to be a stable platform with long-term support.

Debian

The package manager for Debian and most of its derivatives is Debian Package (DPKG). Debian is releasing at a much slower pace than other Linux distributions, such as Linux Mint or Ubuntu, for example, but it's relatively more stable.

Ubuntu

Ubuntu uses Advanced Package Tool (APT) and DKPG as package managers. Ubuntu is one of the most popular Linux distributions, releasing every 6 months, with more stable Long Term Support (LTS) releases every other year.

Linux Mint

Linux Mint uses APT as its package manager. Built on top of Ubuntu, Linux Mint is mostly suitable for desktop use, with a lower memory usage than Ubuntu (with the Cinnamon desktop environment, compared to Ubuntu's GNOME). There's also a version of Linux Mint built directly on top of Debian, called Linux Mint Debian Edition (LMDE).

openSUSE

openSUSE uses RPM, Yet another Setup Tool (YaST), and Zypper as package managers. openSUSE is a bleeding-edge Linux distribution, suited to both desktop and server environments. SUSE Linux Enterprise Server is the commercial-grade platform. openSUSE was regarded as one of the most user-friendly desktop Linux distributions before the days of Ubuntu.

Important note

In this book, our focus is mainly on two Linux distributions, widely used in both community and commercial deployments, Ubuntu and CentOS.

The following section presents some hands-on use cases, where, depending on specific functional requirements, we choose the right Linux distribution.

Linux distributions – a practical guide

The following use cases are inspired by real-world problems, taken mostly from the authors' own experience in the software engineering field. Each of these scenarios presents the challenge of choosing the right Linux distribution for the job.

Case study – development workstation

This case study is based on the following scenario made from the perspective of a software developer:

I'm a backend/frontend developer, writing mostly in Java, Node.js, Python, and Golang, and using mostly IntelliJ and VS Code as my primary IDE. My development environment makes heavy use of Docker containers (building and deploying) and I occasionally use VMs (with VirtualBox) to deploy and test my code locally. I need a robust and versatile development platform.

Functional requirements

The requirements suggest a relatively powerful day-to-day development platform, either as a PC/desktop or a laptop computer. The developer relies on local resources to deploy and test the code (for instance, Docker containers and VMs), perhaps frequently in an offline (airplane mode) environment if on the go.

System requirements

The system would be primarily using the Linux desktop environment and window manager, with frequent context switching between the Integrated Development Environment (IDE) and terminal windows. The required software packages for the IDE, Docker, hypervisor (VirtualBox), and tools should be readily available from open source or commercial vendors, ideally always being up to date and requiring minimal installation and customization effort.

Linux distribution

The choice here would be the Ubuntu Desktop Long Term Support (LTS) platform. Ubuntu LTS is relatively stable, runs on virtually any hardware platform, and it's mostly up to date with hardware drivers. Software packages for the required applications and tools are generally available and stable, with frequent updates. Ubuntu LTS is an enterprise-grade, cost-effective, and secure operating system suitable for organizations and home users alike.

Case study – secure web server

This case study is based on the following scenario made from the perspective of a DevOps engineer:

I'm looking for a robust platform running a secure, relatively lightweight, and enterprise-grade web server. This web server handles HTTP/SSL requests, offloading SSL before routing requests to other backend web servers, websites, and API endpoints. No load-balancing features are needed.

Functional requirements

When it comes to open source, secure, and enterprise-grade web servers, the top choices are usually NGINX, Apache HTTP Server, Node.js, Apache Tomcat, and Lighttpd. Without going into the details of choosing one web server over another, let's just assume we pick Apache HTTP Server. It has state-of-the-art SSL/TLS support, excellent performance, and is relatively easy to configure.

We deploy this web server in VPS environments, in local (on-premises) data centers, or the public cloud. The deployment form factor is either a VM or a Docker container. We are looking for a relatively low-footprint, enterprise-grade Linux platform.

Linux distribution

Our choice is CentOS. Most of the time, CentOS and Apache HTTP Server are a perfect match. CentOS is relatively lightweight, coming only with barebone server components and an operating system networking stack. It is widely available as a VPS deployment template in private and public cloud vendors. There is also CentOS Atomic Host, a Linux distribution designed to run Docker containers. Our Apache HTTP Server can run as a Docker container on top of CentOS Atomic, as we may horizontally scale to multiple web server instances.

Use case – personal blog

This case study is based on the following scenario made from the perspective of a software engineer and blogger:

I want to create a software engineering blog. I'll be using the Ghost blogging platform, running on top of Node.js, with MySQL as the backend database. I'm looking for a Virtual Private Server (VPS) solution hosted by one of the major cloud providers. I'll be installing, maintaining, and managing the related platform myself. Which Linux distribution should I use?

Functional requirements

We are looking for a self-managed publicly hosted VPS solution. The related hosting cost is a sensitive matter. Also, the maintenance of the required software packages should be relatively easy. We foresee frequent updates, including the Linux platform itself.

Linux distribution

Our pick is Ubuntu Server LTS. As previously highlighted, Ubuntu is a robust, secure, and enterprise-class Linux distribution. The platform maintenance and administration efforts are not demanding. The required software packages – Node.js, Ghost, and MySQL – are easily available and are well maintained. Ubuntu Server has a relatively small footprint. We can run our required software stack for blogging well within the Ubuntu system requirements so that the hosting costs would be reasonable.

Use case – media server

This case study is based on the following scenario made from the perspective of a home theater aficionado:

I have a moderately large collection of movies (personal DVD/Blu-ray backups), videos, photos, and other media, stored on Network Attached Storage (NAS). The NAS has its own media server incorporated, but the streaming performance is rather poor. I'm using Plex as a media player system, with Plex Media Server as the backend. What Linux platform should I use?

Functional requirements

The critical system requirements of a media server are speed (for a high-quality and smooth streaming experience), security, and stability. The related software packages and streaming codecs are subject to frequent updates, so platform maintenance tasks and upgrades are quite frequent. The platform is hosted locally, on a PC desktop system, with plenty of memory and computing power in general. The media is being streamed from the NAS, over the in-house Local Area Network (LAN), where the content is available via a Network File System (NFS) share.

Linux distribution

Both Debian and Ubuntu would be excellent choices for a good media server platform. Debian's stable release is regarded as rock solid and very reliable by the Linux community, although it's somewhat outdated. Both feature advanced networking and security, but what may come as a decisive factor in choosing between the two is that Plex Media Server has an ARM-compatible package for Debian. The media server package for Ubuntu is only available for Intel/AMD platforms. If we owned a small-factor, ARM processor-based appliance, Debian would be our choice. Otherwise, Ubuntu LTS would serve our purpose just as well.

Installing Linux – the basics

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.

How to install Linux

Here are the essential steps usually required for a Linux installation.

Step 1 – download

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).

Step 2 – create a bootable media

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

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):

  1. Choose our Linux distribution (Ubuntu).
  2. Specify the version of our Linux distribution (20.04).
  3. Select the disk image type that matches our download (ISO).
  4. Browse to the location of our downloaded ISO image (ubuntu-20.04-live-server-amd64.iso).
  5. Specify the media format of our bootable drive (USB).
  6. Choose the filesystem mount of our USB drive (/dev/disk2s2)

Now, let's look at how we can take the bootable media for a spin.

Step 3 – try it out in live mode

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:

  • Booting a PC/Mac workstation from our bootable media
  • Launching a VM created with our Linux distribution ISO

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

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.

Step 4 – perform the installation

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.

Linux in a VM

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.

Installing Ubuntu

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.

VM provisioning

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

Figure 1.4 – Creating a new VM based on the Ubuntu ISO image

Let's look at the steps:

  1. We start by creating a new VM based on the Ubuntu Server ISO. For illustration purposes, we use VMware Workstation. Figure 1.4 shows the initial screen of creating a new VM for an Ubuntu Server instance.
  2. Following the VM deployment wizard, we get to the final step summarizing the VM provisioning information (Figure 1.5):
    Figure 1.5 – Customizing the VM settings

    Figure 1.5 – Customizing the VM settings

  3. Sometimes the default VM sizing may have to be changed to accommodate the minimum system requirements of our Linux distribution. In our case, Ubuntu Server requires a minimum hard disk capacity of 25 GB. We can further customize the VM settings and increase the disk capacity, for example, to 30 GB (Figure 1.6):
Figure 1.6 – Customizing the VM disk size

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.

Installation

Here's the normal installation process for Ubuntu Server LTS, following the initial boot into setup mode:

  1. Make sure we choose Install Ubuntu in the initial setup screen (we assume that live mode has already been visited, according to Figure 1.3):
  2. The initial welcome screen prompts for the language of our choice (English), followed by the keyboard layout (English (US)):
  3. Next, we need to set up the server profile, which requires a display name (Packt), a server name (neptune), a username (packt), and the password (Figure 1.7):
    Figure 1.7 – Setting up the server profile

    Figure 1.7 – Setting up the server profile

  4. The next screen is asking for the OpenSSH server package installation (Figure 1.8). OpenSSH enables secure remote access to our server. We choose to check (using [X]) the option for Install OpenSSH server. Optionally, we can import our existing SSH keys for passwordless authentication:
    Figure 1.8 – Enabling the OpenSSH server

    Figure 1.8 – Enabling the OpenSSH server

  5. An additional screen presents us with popular software packages (Snaps) that we may want to install (Figure 1.9). Among them, there are a few we'll be covering in later chapters (microk8s, docker, and aws-cli):
    Figure 1.9 – Enabling additional software packages

    Figure 1.9 – Enabling additional software packages

  6. If everything goes well, a few minutes later, we get the Installation complete! screen, prompting us to reboot.

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.

Installing CentOS

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.

VM provisioning

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:

  1. The VirtualBox setup wizard guides us through the following configuration steps of our VM (we specify our choices as shown):

    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)

  2. After a few steps, we end up with a VirtualBox configuration window of our VM, similar to the following (Figure 1.10):
    Figure 1.10 – VirtualBox VM configuration

    Figure 1.10 – VirtualBox VM configuration

  3. We can do further customization by choosing Settings in the VirtualBox Manager window of our VM. Next, we should point the IDE controller of our VM to the CentOS ISO image we want to install. We choose Settings | Storage | Optical Drive | IDE Secondary Master and click the disk icon. Here, we browse to the location of our CentOS image file. We want the VM to use the IDE Secondary Master ISO file, to boot from and install our operating system (Figure 1.11):
Figure 1.11 – Virtual Box VM storage settings

Figure 1.11 – Virtual Box VM storage settings

At this stage, starting the VM initiates the CentOS installation.

Installation

Here's the normal installation process for CentOS, following the initial boot into setup mode:

  1. First, we get the welcome screen with the choice of either installing or testing (in live mode) the CentOS Linux platform (Figure 1.12):
    Figure 1.12 – The CentOS welcome screen

    Figure 1.12 – The CentOS welcome screen

  2. In the next few steps of the installation process, we get to choose our options for the following:

    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.13 – The CentOS installation summary

  3. The final step of the CentOS installation is about configuring the local user accounts on our Linux platform (Figure 1.14):
    Figure 1.14 – The CentOS user settings

    Figure 1.14 – The CentOS user settings

  4. The user configuration screen prompts for a root password and a new user account. In our case, we create a user account (packt) with administrator privileges. This account has full administrative privileges over the system, yet it doesn't have root access. In later chapters, we'll show how to give superuser (sudo) privileges to our administrator account (Figure 1.15):
    Figure 1.15 – Rebooting CentOS after installation

    Figure 1.15 – Rebooting CentOS after installation

  5. Upon finishing the user configuration, we reboot the system, and this takes us to the CentOS login screen. We have completed the CentOS installation. We may have to remove the installation media or unmount the IDE interface on the VM before the reboot, to avoid circling back into setup mode again.

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.

The Windows Subsystem for Linux (WSL)

Software developers and system administrators often face a tough decision in choosing the appropriate hardware and operating system platform for the specific requirements of their work or environment. In the past, Windows professionals were frequently reminded that some standard development tools, frameworks, or server components were available at large on Linux or macOS platforms, while lacking native support on Windows. Windows Subsystem for Linux (WSL) attempts to close this gap.

WSL is a Windows 10 platform feature that provides a native GNU/Linux runtime along with the Windows desktop environment. WSL enables the seamless deployment and integration of select Linux distributions on top of the Windows kernel, without the need for a dedicated hypervisor. With WSL enabled, you can easily install and run Linux as a native Windows application.

Important note

Without WSL, we could only deploy and run a Linux distribution on a Windows platform by using a standalone hypervisor, such as Hyper-V, Oracle VM VirtualBox, or VMware Workstation. WSL eliminates the need for a dedicated hypervisor. At the time of writing, WSL is a Windows kernel extension with a hypervisor embedded.

In this section, we provide the steps required to enable WSL and run an Ubuntu distribution on Windows. The following commands are executed on a Windows machine (or VM) in a PowerShell CLI with administrator privileges:

  1. First, we need to enable the Windows Subsystem for Linux optional feature in Windows:
    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

    We should get the result shown in Figure 1.16:

    Figure 1.16 – Enabling the WSL optional feature

    Figure 1.16 – Enabling the WSL optional feature

  2. Next, we want to make sure WSL 2 is supported on our Windows platform. We need Windows 10, version 2004, build 19041 or higher.

    WSL 2 uses hypervisor technology. We need to enable the Virtual Machine Platform optional feature for Windows:

    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

    The result should be similar to Figure 1.17:

    Figure 1.17 – Enabling the VM platform optional feature

    Figure 1.17 – Enabling the VM platform optional feature

  3. At this point, we need to restart our Windows machine to complete the WSL installation and upgrade to WSL 2.

    Important note

    The Windows restart may feature an Update and Restart option. We need to make sure that the system gets updated upon restart.

  4. After the restart, we need to set WSL 2 as our default version:
    wsl --set-default-version 2

    This command may yield the message shown in Figure 1.18:

    Figure 1.18 – Further update needed for WSL 2

    Figure 1.18 – Further update needed for WSL 2

  5. Just follow the instructions in the link to circumvent the problem. After proceeding with these steps, we have to rerun the preceding command. If successful, the command output is similar to Figure 1.19:
    Figure 1.19 – Setting the default version to WSL 2

    Figure 1.19 – Setting the default version to WSL 2

  6. With WSL 2 active, we are ready to install our Linux distribution of choice. Open the Microsoft Store and simply search for Linux (Figure 1.20):
    Figure 1.20 – Searching for Linux distro apps in the Microsoft Store

    Figure 1.20 – Searching for Linux distro apps in the Microsoft Store

  7. We choose to install Ubuntu (Figure 1.21) and then follow the installation procedure driven by the Windows Store app. Ubuntu is installed just like any regular Windows application. When finished, we run Ubuntu by launching the application from the Windows Start menu:
Figure 1.21 – Installing the Ubuntu app

Figure 1.21 – Installing the Ubuntu app

After installation, Ubuntu runs as a traditional Windows desktop command-line application.

WSL enables a swift adoption of Linux for a growing number of Windows professionals. As shown in this section, WSL is relatively easy to configure, and with WSL, there's no need for a dedicated hypervisor to run a Linux instance.

Important note

WSL currently doesn't support a GUI-driven Linux runtime. With WSL, we are exclusively interacting via the CLI.

In the following section, we take a quick look at the Linux graphical user interface and two of the most prominent Linux desktop environments: GNOME and KDE.

Installing Linux graphical user interfaces

The Linux GUI is the desktop environment that allows users to interact with system-level components via windows, icons, menus, or other visual elements. For Linux users who look beyond the CLI, the choice of a Linux distribution may start with the desktop environment. Choosing a desktop environment is ultimately a matter of taste. And for some, the ultimate GUI represents the very extension of their eyes and hands at work.

Among the multitude of Linux desktop environments, there are two that stand out. Let's take a brief look at them.

GNOME

With its current GNOME 3 (or GNOME Shell) iteration, this GUI platform is one of the most common Linux desktop environments. Nowadays, almost every major Linux distribution comes with GNOME as the default GUI. The Linux open source community also created GNOME Extensions, which overcomes some of the infamous shortcomings of GNOME and extends the desktop functionality to suit a variety of needs. When it's not the default desktop environment (such as with Linux Mint's Cinnamon desktop), GNOME can easily be installed and adapted.

At the time of writing, the latest distributions of Ubuntu (20.04 LTS) and CentOS (8) have GNOME as their default GUI.

Installing the GNOME desktop

Let's look at a real-world scenario requiring the installation of the latest GNOME desktop.

Ubuntu Server administrator:

I installed the latest version of Ubuntu Server LTS (20.04), and it looks like the GUI desktop is missing. How do I install the GNOME desktop on my Ubuntu Server?

Let's look at how to install it on Ubuntu:

  1. We start by making sure the current package lists and installed software packages are up to date. The following command updates the local package repository metadata for all configured sources:
    sudo apt-get update -y

    Now, we can upgrade with this:

    sudo apt-get upgrade -y
  2. To browse all the available ubuntu-desktop packages, run this:
    apt-cache search ubuntu-desktop
  3. We choose to install the ubuntu-desktop package (the first option in the preceding list):
    sudo apt-get install ubuntu-desktop -y
  4. The command will take a few minutes to complete. When done, we need to check the status of the GNOME Display Manager (GDM) service and make sure it shows an active (running) status:
    systemctl status gdm

    The expected response should be similar to Figure 1.22:

Figure 1.22 – Checking the status of GDM

Figure 1.22 – Checking the status of GDM

The GNOME 3 desktop is now installed and active on Ubuntu Server (Figure 1.23):

Figure 1.23 – The Ubuntu GNOME desktop login screen

Figure 1.23 – The Ubuntu GNOME desktop login screen

Next, let's take a look at the KDE desktop and a similar case study of enabling it on a Linux server platform.

KDE

Linux administrators usually look for a desktop environment that is relatively easy to use, lightweight, and efficient. KDE combines all of these attributes into a reliable and speedy desktop interface. Users familiar with Windows (up to version 7) would feel very much at home with KDE.

KDE has become a very robust desktop environment over the last few iterations, and versions of KDE have been released for almost every major Linux distribution.

If there's one ideal desktop for Linux administrators, KDE comes very close.

Installing the KDE desktop

In this section, we take a fresh CentOS 8 installation with the default GNOME desktop enabled and replace it with KDE.

CentOS 8 administrator:

I installed the latest version of CentOS 8, choosing the "Server with GUI" option during setup. It looks like the CentOS 8 GUI runs the GNOME desktop. How do I install the KDE desktop on my CentOS 8 server?

When we click the cogwheel in the CentOS 8 login screen, we get a list of the currently installed display servers. The default is Standard, a GNOME implementation of the Wayland compositor protocol for Linux desktop management. Wayland also has a KDE implementation in its latest KDE Plasma iteration at the time of writing (Figure 1.24):

Figure 1.24 – The default CentOS 8 GNOME login screen

Figure 1.24 – The default CentOS 8 GNOME login screen

Let's add the KDE Plasma desktop to our CentOS 8 server:

  1. We log in to the CentOS 8 GUI and open the terminal, as suggested in the following illustration (Figure 1.25). Alternatively, we can simply SSH into the CentOS 8 server and run the commands in a similar CLI:
    Figure 1.25 – Opening the terminal in CentOS

    Figure 1.25 – Opening the terminal in CentOS

  2. The following commands have to be executed either as root or by a user account with sudoer privileges. Let's add our administrator user account (packt) to the sudoers group. We need to switch to root to run the required command:
    su
  3. We get prompted for the root password (specified during the CentOS installation). See the Installing CentOS section for the related information. To add our packt user to the sudoers group, run this:
    usermod -aG wheel packt
  4. When the command finishes, switch to our newly minted sudoer account:
    su - packt
  5. Verify that our packt account does indeed have sudoer privileges:
    sudo whoami

    The command should prompt for the packt user password and then yield root.

  6. Next, proceed with the installation of the EPEL configuration files, enabling the related repositories:
    sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
  7. Follow that by enabling the CentOS PowerTools repository (needed by KDE). We use dnf (Dandified YUM), a package manager CLI for RPM-based Linux distributions:
    sudo dnf -y config-manager --enable PowerTools
  8. Finally, we install the KDE Plasma desktop package group. The next command downloads a relatively large number of files (approximately 400 MB), and it may take a while:
    sudo dnf -y group install kde-desktop

    When the kde-desktop installation completes successfully, the output ends with a Complete! message prompt.

  9. Now that the KDE Plasma desktop has been installed, we can either reload the GNOME Desktop Manager (gdm) to account for the changes or simply reboot:
    sudo systemctl reload gdm
  10. If we have a CentOS 8 VM environment, a reboot is recommended:
    reboot

    We are now able to log in to CentOS 8 using the KDE Plasma desktop. Clicking the cogwheel in the login window, we can see the Plasma desktop available (Figure 1.26):

    Figure 1.26 – Choosing the KDE Plasma desktop

    Figure 1.26 – Choosing the KDE Plasma desktop

  11. Once we're logged in, we can customize the KDE Plasma desktop to our preference (Figure 1.27):
Figure 1.27 – Customizing the KDE Plasma desktop

Figure 1.27 – Customizing the KDE Plasma desktop

In this section, we briefly looked at the Linux GUI and showcased the installation of the GNOME and KDE desktop environments on Ubuntu Server and CentOS, respectively. Next, we provide a quick guide on setting up a Linux workstation with some insight into various software packages and applications that could benefit our everyday work.

Setting up and using the Linux workstation

In this section, we will learn how to set up and use a Linux platform as our primary workstation for day-to-day work. We choose the Ubuntu Desktop LTS distribution, but any other modern-day Linux distribution would fit the bill. We aim to showcase some basic user operations and workflows for building and using a general-purpose Linux desktop.

As we did in the previous sections about installing a Linux distribution, we start with a brief installation guide of Ubuntu Desktop LTS.

Installing Ubuntu Desktop

If we plan to install Ubuntu Desktop on a VM, there are some preliminary steps required for provisioning the VM environment. Otherwise, we proceed directly with the Installation section.

VM provisioning

The VM provisioning procedure is very similar to the procedure described in the Installing Ubuntu section, with Ubuntu Server LTS.

We have to pay attention to the minimum system requirements of our Linux distribution and size the VM accordingly. In our case, Ubuntu Desktop requires a dual-core CPU, at least 4 GB RAM, and a minimum hard disk capacity of 25 GB. Since we plan to install a handful of additional software packages, we set the hard disk capacity to 60 GB (at least).

Installation

Ubuntu Desktop installation is relatively straightforward and requires very few user actions:

  1. As with the most modern Linux distributions, the very first choice we get is between trying out Ubuntu in live mode or simply proceeding with the installation. The related screen is similar to Figure 1.3.
  2. Beyond the welcome screen, there are a few more steps with the following configuration settings:

    a) Keyboard layout

    b) Installation type (normal versus minimal)

    c) Localization and time zone

    d) User configuration (account credentials) (Figure 1.28):

    Figure 1.28 – Setting up the hostname and user credentials

    Figure 1.28 – Setting up the hostname and user credentials

  3. Past this point, the installation files are unpackaged and copied, while we are briefly introduced to the most attractive features of the Ubuntu platform.

After the installation completes, the system reboot takes us to the Ubuntu Desktop login screen. At this point, we have completed the Ubuntu Desktop installation.

Default software packages

The default Ubuntu Desktop installation gets us a handful of software packages and productivity tools, enough for our general-purpose, day-to-day work. Here are just a few examples:

  • Calculator: Arithmetic, scientific, and financial calculations.
  • Calendar: Access and manage your calendars.
  • Disks: Manage drives and media.
  • Files: Access and organize files.
  • Firefox: Web browser.
  • Image Viewer: Browse and rotate images.
  • LibreOffice: Productivity suite – Calc (spreadsheet), Draw (graphics), Impress (presentation), and Writer (word processor).
  • Logs: System logs.
  • Remmina: Remote desktop connection.
  • Rhythmbox: Organize and play music.
  • Screenshot: Capture and save images of the screen or individual windows.
  • Settings: GNOME desktop configuration utility.
  • Shotwell: Organize photos.
  • Thunderbird Mail: Send and receive mail.
  • To Do: Manage personal tasks.
  • Videos: Play movies.

To view all currently installed applications, we click on the Ubuntu Software icon in the taskbar and then on the Installed tab. We could choose to remove (uninstall) any of these applications if we wanted to save disk space (Figure 1.29):

Figure 1.29 – Adding or removing Ubuntu applications

Figure 1.29 – Adding or removing Ubuntu applications

To browse or open any of these applications, click the grid icon (Show applications) at the bottom of the taskbar and then search for our application by beginning to type its name (Figure 1.30):

Figure 1.30 – Searching for installed applications

Figure 1.30 – Searching for installed applications

Next, let's take a look at how to install additional applications on our Ubuntu Linux workstation.

Additional software packages

A power user may need additional software, tools, or utilities beyond the ones provisioned with the default Ubuntu Desktop installation. To add new applications, we click on the Ubuntu Software icon in the taskbar, followed by Explore, and then on the search icon. In the example illustrated in the following figure, we look for Visual Studio Code, a powerful code editor.

In general, when we decide on a particular application we want to install, we select the application, and this opens up a window for installing the related Ubuntu software package. Once we have completed the installation, the application shows up in the Installed section, where we can later uninstall it, if we choose to do so (Figure 1.31):

Figure 1.31 – Installing new applications

Figure 1.31 – Installing new applications

Different power users may look for a particular category of applications, tools, or utilities. Here are just a few of the most common types of productivity tools and applications used by the Linux user community. Some of them are readily available for download via the Ubuntu Software package management interface. Others can be downloaded from their related vendor websites.

Here are some commonly used applications for email and collaboration available for Ubuntu and other major Linux distributions:

  • Hiri: Cross-platform email client, a real alternative to Microsoft Outlook.
  • Thunderbird Mail: Send and receive emails (installed by default).
  • Slack for Linux: Channel-based instant messaging platform.
  • Teams for Linux: Instant messaging; unofficial Microsoft Teams client for Linux.

Image editing tools abound for Linux. Here are just a few:

  • GIMP: Image manipulation program
  • digiKam: Photo editing software
  • KRITA: Free image editing and artistry

Most software development IDEs and tools are cross-platform these days. Ubuntu and many other Linux distros are not an exception in offering a vast array of such applications:

  • Visual Studio Code: Code editing
  • Sublime Text: Code editing, markup
  • Atom: Highly customizable code editor
  • Eclipse: Extensible tool platform and Java IDE
  • IDEA Ultimate: Capable and ergonomic Java IDE for enterprise, web, and mobile development
  • Terminator: Multiple terminals in one window

Virtualization and containerized workflows are in high demand now more than ever. All major hypervisors and container orchestration platforms are available for Linux as well:

  • VirtualBox: VM manager by Oracle.
  • VMware Workstation: VM manager by VMware.
  • Docker Engine: Open source containerization platform.
  • MicroK8s: Lightweight Kubernetes for workstations and appliances.
  • Minikube: Run Kubernetes locally.

Small-factor Linux PCs and appliances are often the ideal platforms for media servers. These are the most common media server applications generally available for almost any Linux distribution:

  • Plex Media Server: Organize media libraries and stream to any device.
  • Kodi: Manage and view media.

In our highly collaborative world, screen capture and recording tools always come in handy. Here are just a few:

  • Screenshot: Capture and save images of the screen or individual windows (installed by default).
  • Kazam: Record a video or take a screenshot.
  • OBS Studio: Live streaming and screen recording.

Some of these applications may require a CLI for installation. Other applications are available either as a software package installer in the Ubuntu Software management user interface or via the APT package manager CLI (apt-get).

As we have previously shown, installing an application via the Ubuntu Software management interface is straightforward. Next, we take a look at Ubuntu's APT package manager platform and CLI.

Managing software packages with APT

APT is the default package manager in Ubuntu, and it's a platform interface for installing and removing software packages. As a core system library of Ubuntu, APT is a collection of tools and CLI programs helping with package and repository management: apt, apt-cache, and apt-get.

Important note

APT and DPKG: In essence, APT is a shim (frontend) to DPKG – the package manager of Debian Linux distributions. The apt CLI invokes the dpkg CLI under the hood.

Let's look at a few examples of using the apt-get and dpkg CLI tools for installing and managing software packages.

Case study – installing Java (OpenJDK)

This scenario is from the perspective of a Java developer:

I have a powerful developer machine running Ubuntu Desktop. I work on a project that requires Java development. How do I install OpenJDK on my machine?

We assume an Ubuntu Desktop platform and OpenJDK version 14 for our case study.

Let's look at how to install OpenJDK (Java Development Kit):

  1. Before installing OpenJDK, let's make sure the current package lists and installed software packages are up to date. Start by updating the local package repository metadata for all configured sources:
    sudo apt-get update -y

    Next, proceed with the upgrade:

    sudo apt-get upgrade -y

    The preceding commands require superuser (sudo) privileges. We have to enter the password for our privileged (administrator) account. The -y option runs the apt-get command without requiring further user interaction.

  2. Now, we are ready to install OpenJDK 14:
    sudo apt-get install -y openjdk-14-jre-headless
  3. Let's make sure the OpenJDK environment is ready. Get the OpenJDK version:
    java --version

    This command should yield the following response for our freshly installed OpenJDK (Figure 1.32):

    Figure 1.32 – Testing the OpenJDK installation

    Figure 1.32 – Testing the OpenJDK installation

  4. We can verify the status of the OpenJDK installation with this:
    dpkg --list openjdk-14-jre-headless

    The preceding command yields a response similar to Figure 1.33:

    Figure 1.33 – Querying the OpenJDK package using dpkg

    Figure 1.33 – Querying the OpenJDK package using dpkg

    Alternatively, we can use the apt-cache CLI to verify the status of the OpenJDK package:

    apt-cache policy openjdk-14-jre-headless

    The output is similar to Figure 1.34:

    Figure 1.34 – Querying the OpenJDK package using apt-cache

    Figure 1.34 – Querying the OpenJDK package using apt-cache

  5. To remove OpenJDK, run the following:
    sudo apt-get remove openjdk-14-jre-headless

    Or, you can use dpkg:

    sudo dpkg --remove openjdk-14-jre-headless

To find out more about the dpkg CLI options, run dpkg --help. To get more information on the apt CLI tools, run man apt.

Case study – installing Plex Media Server

This scenario is from the perspective of a home theater enthusiast:

I'm using Plex as a media player system, with Plex Media Server as the backend. I want to migrate my Plex Media Server to Linux. How do I install Plex Media Server on Ubuntu?

To install Plex Media Server (PMS) on Ubuntu, follow these steps:

  1. Make sure the current package lists and installed software packages are up to date. Start by updating the local package repository for all configured sources:
    sudo apt-get update -y

    Next, run the upgrade:

    sudo apt-get upgrade -y

    According to the vendor's website, there are specific prerequisites regarding enabling the related repository, which we don't detail here.

  2. The vendor also recommends the use of the dpkg CLI for installing PMS; use the following command:
    sudo dpkg -i plexmediaserver_1.19.4.2935-79e214ead_amd64.deb
  3. We can verify the status of our plexmediaserver installation with the following:
    dpkg --list plexmediaserver

    The preceding command results in a response similar to Figure 1.35:

    Figure 1.35 – Querying the PMS package using dpkg

    Figure 1.35 – Querying the PMS package using dpkg

  4. To remove the plexmediaserver package, run this:
    sudo dpkg --remove plexmediaserver

To find out more about the dpkg CLI options, run dpkg --help.

Summary

In this chapter, we learned about Linux distributions, with a practical emphasis on choosing the right platform for our needs and performing the related installation procedures. Along the way, we showcased some hands-on, real-world scenarios that we thought are relevant for the topics covered, and to better capture the why or how of what we learned.

Throughout the chapter, the main emphasis has been on the Ubuntu and CentOS Linux distributions. In the spirit of the practical approach, we covered both physical and VM environments running Linux. We also took a short route through the Windows realm, where we touched upon WSL, a modern-day abstraction of Linux as a native Windows application.

We took the exercise of building a Linux workstation with some hands-on examples of how to customize the applications and tools we need for our everyday work.

With the skills learned in this chapter, we hope you'll have a better understanding of how to choose different flavors of Linux distros based on your needs. You've learned how to install and configure Linux on a variety of platforms: server, desktop, VM, and WSL. We also started exploring using the Linux command-line terminal for some of the tasks described in our case studies. You will use some of these skills throughout the rest of the book, but most importantly, you'll now be comfortable quickly deploying the Linux distribution of your choice and testing with it.

In today's increasingly rapid and agile development environments, Continuous Integration and Continuous Delivery (CI/CD) infrastructures make heavy use of Linux distros. Future chapters will introduce you to containerized workflows, and the knowledge gained in this chapter will help you with the design and deployment efforts of Linux containers.

Starting with the next chapter, we'll take a closer look at the various Linux subsystems, components, services, and applications. Chapter 2, The Linux Filesystem, will familiarize you with the Linux filesystem internals and related tools.

Questions

Here are a few questions and thought experiments that you may ponder, some based on the skills you have learned in this chapter, and others revealed in later parts of the book:

  1. My Linux workstation is running low on disk space. How do I uninstall or remove applications that I don't use anymore?

    Hint: Software packages installed with GUI package management tools can be uninstalled from the same GUI (for instance, see Figure 1.36). Others can be removed using the package manager CLI tools (for instance, apt, dpkg, and rpm).

  2. If I had a relatively large number of Linux VM instances or distros deployed and running at the same time, how would I make it easier to manage them?

    Hint: Use Vagrant, a tool for building and managing VM environments.

  3. How do I enable multiple GUI desktops (GNOME, KDE) for different users on the same Linux system?

    Hint: In the Installing Linux graphical user interfaces section, we showcased the addition of KDE side by side with GNOME. Each user can log in with their GUI desktop of choice (see Figure 1.31).

  4. I'm looking for a robust email client and team collaboration solution for my Linux workstation.

    Hint: The Additional software packages section may provide some guidance.

  5. Can I run multiple Linux instances in WSL?

    Hint: Yes. Use wsl --import.

  6. How do I upgrade my Linux machine to a new version of the distro?

    Hint: Create a bootable media of your new Linux distro and run the installer. Choose to upgrade when prompted. You may also use the command line. Check out the related CLI tools for your Linux distro (for instance, do-release-upgrade for Ubuntu).

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Become proficient in everyday Linux administration tasks by mastering the Linux command line and using automation
  • Work with the Linux filesystem, packages, users, processes, and daemons
  • Deploy Linux to the cloud with AWS, Azure, and Kubernetes

Description

Linux plays a significant role in modern data center management and provides great versatility in deploying and managing your workloads on-premises and in the cloud. This book covers the important topics you need to know about for your everyday Linux administration tasks. The book starts by helping you understand the Linux command line and how to work with files, packages, and filesystems. You'll then begin administering network services and hardening security, and learn about cloud computing, containers, and orchestration. Once you've learned how to work with the command line, you'll explore the essential Linux commands for managing users, processes, and daemons and discover how to secure your Linux environment using application security frameworks and firewall managers. As you advance through the chapters, you'll work with containers, hypervisors, virtual machines, Ansible, and Kubernetes. You'll also learn how to deploy Linux to the cloud using AWS and Azure. By the end of this Linux book, you'll be well-versed with Linux and have mastered everyday administrative tasks using workflows spanning from on-premises to the cloud. If you also find yourself adopting DevOps practices in the process, we'll consider our mission accomplished.

Who is this book for?

If you are a Linux administrator who wants to understand the fundamentals and as well as modern concepts of Linux system administration, this book is for you. Windows System Administrators looking to extend their knowledge to the Linux OS will also benefit from this book.

What you will learn

  • Understand how Linux works and learn basic to advanced Linux administration skills
  • Explore the most widely used commands for managing the Linux filesystem, network, security, and more
  • Get to grips with different networking and messaging protocols
  • Find out how Linux security works and how to configure SELinux, AppArmor, and Linux iptables
  • Work with virtual machines and containers and understand container orchestration with Kubernetes
  • Work with containerized workflows using Docker and Kubernetes
  • Automate your configuration management workloads with Ansible

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 18, 2021
Length: 772 pages
Edition : 1st
Language : English
ISBN-13 : 9781789954272
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Jun 18, 2021
Length: 772 pages
Edition : 1st
Language : English
ISBN-13 : 9781789954272
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 129.97
Mastering PowerShell Scripting
€59.99
Linux for Networking Professionals
€36.99
Mastering Linux Administration
€32.99
Total 129.97 Stars icon
Banner background image

Table of Contents

19 Chapters
Section 1: Linux Basic Administration Chevron down icon Chevron up icon
Chapter 1: Installing Linux Chevron down icon Chevron up icon
Chapter 2: The Linux Filesystem Chevron down icon Chevron up icon
Chapter 3: Linux Software Management Chevron down icon Chevron up icon
Chapter 4: Managing Users and Groups Chevron down icon Chevron up icon
Chapter 5: Working with Processes, Daemons, and Signals Chevron down icon Chevron up icon
Section 2: Advanced Linux Server Administration Chevron down icon Chevron up icon
Chapter 6: Working with Disks and Filesystems Chevron down icon Chevron up icon
Chapter 7: Networking with Linux Chevron down icon Chevron up icon
Chapter 8: Configuring Linux Servers Chevron down icon Chevron up icon
Chapter 9: Securing Linux Chevron down icon Chevron up icon
Chapter 10: Disaster Recovery, Diagnostics, and Troubleshooting Chevron down icon Chevron up icon
Section 3: Cloud Administration Chevron down icon Chevron up icon
Chapter 11: Working with Containers and Virtual Machines Chevron down icon Chevron up icon
Chapter 12: Cloud Computing Essentials Chevron down icon Chevron up icon
Chapter 13: Deploying to the Cloud with AWS and Azure Chevron down icon Chevron up icon
Chapter 14: Deploying Applications with Kubernetes Chevron down icon Chevron up icon
Chapter 15: Automating Workflows with Ansible Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.4
(15 Ratings)
5 star 66.7%
4 star 20%
3 star 6.7%
2 star 0%
1 star 6.7%
Filter icon Filter
Top Reviews

Filter reviews by




Carl L Oct 17, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Mastering Linux Administration by Alexandru Calcatinge and Julian Balog is a valuable resource for anyone looking to build a strong foundational knowledge of the Linux operating system and administration of a range of uses for Linux – whether that’s a desktop workstation or a server deployment.Key Strengths:• Depth and Breadth: The book covers a wide range of topics, from installation and fundamental system administration tasks to more advanced concepts like networking, security, virtualization/containerization and cloud-based deployments and administration. The breadth of topics and coverage makes the book a versatile resource for both beginners and experienced administrators.• Practical Examples: Throughout the book, the authors provide numerous practical examples and exercises to reinforce learning. This hands-on approach is particularly helpful for those who, like me, prefer to learn by doing.• Clear and Concise Explanations: The content is presented in a clear and concise manner, making it easy to follow even complex concepts by avoiding overly technical jargon and acronyms that may not be familiar to beginners, and provides ample explanations to ensure understanding of the content.• Real-World Scenarios: The book addresses real-world scenarios and challenges that system administrators often encounter in a way that helps to bridge the gap between “book knowledge” and practical application.Overall, Mastering Linux Administration is a highly recommended resource for anyone looking to expand their Linux system administration skills. The book builds a solid foundation, uses practical examples, and imparts valuable insights into the world of Linux. Whether you're a seasoned administrator or just starting out, this book will undoubtedly prove to be a valuable addition to any system administrator’s library.
Amazon Verified review Amazon
Marius Istrate Jul 17, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book covers three essential topics in Linux administration. The Basic Linux administration section is very explicit, covering all the basics necessary for the proper use of Linux OS.The book guides you through the process of installing the Linux OS. Then proceeds to offers an in-depth explanation of how it works and how to administrate it.The most valuable part of this book for me was the third section, Cloud administration. It smoothed the transition from running on-premise services to deploying them in the cloud, the steps necessary to run a service in a Docker container, and deploying it as an EC2 instance on AWS or as a pod in Kubernetes.The chapter covering Kubernetes is very instructive, pointing out the main architectural ideas behind Kubernetes and how the whole system works. It presents the general components and how they interact with one another and then proceeds to explain the process for deploying, monitoring, and configuring each one.I use Linux, AWS, and Kubernetes daily and, this book helped to cover the gaps I had in knowledge regarding these.
Amazon Verified review Amazon
Pena Jun 24, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book contains comprehensive and step by step resource that will guide you from the installation of a Linux distribution to advanced topics like Kubernets and automated workflows with Ansible.The book is structured in such a way, that every chapter stands on its own. You do not have to read it from the beginning to the end, but can use it as a reference. I especially liked the hands-on examples supported by detailed figures and screenshots.Another positive aspect to emphasize is the precise wording. No unnecessary sentences, words, or complicated phrases are used.It does some good points here and there, like for example this one:"Securing a Linux machine is usually a balancing act."Even though it has over 750 pages, it's a quick read.I'd recommend it to all programmers, from beginner to expert.
Amazon Verified review Amazon
Marc Chisinevski Jun 26, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Covers a lot of ground from on-premises to the clouds, providing practical recommendations on security, disaster recovery and performance.I've use Linux and Kubernetes on a daily basis for many years and still learned a lot from this book.
Amazon Verified review Amazon
rockstar82 Jun 24, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
There are many books out there, but when something is not working, random blogs are all you have. Not anymore. This book serves as both a quick reference, and short manual for good Linux subjects like Grub, Kubernetes, Ansible.I particularly like the illustrations. In my mind if you understand a topic, you need to be able to clearly explain it with everything you have at your disposal, and in a book like this, words and pictures are all you have. The illustrations alone make the book a worthy purchase for your small Linux library.The short introductions in a wide range of topics from setup, to grub, to basic security and containers, are also excellent themselves and a good replacement for most of the blog posts. In fact, they also support a good narrative built around the idea that you can do everything in Linux today.I hope the authors write a second volume dedicated to security or graphic illustration in Linux! This is definitely one of the best Linux books out there.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.