Mastering Ubuntu Server - Third Edition

5 (4 reviews total)
By Jay LaCroix
    What do you get with a Packt Subscription?

  • Instant access to this title and 7,500+ eBooks & Videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Deploying Ubuntu Server

About this book

Ubuntu Server has taken data centers around the world by storm. Whether you're deploying Ubuntu for a large-scale project or for a small office, it is a stable, customizable, and powerful Linux distribution with innovative and cutting-edge features. For both simple and complex server deployments, Ubuntu's flexible nature can be easily adapted to meet to the needs of your organization.

This third edition is updated to cover the advancements of Ubuntu 20.04 LTS and further train you to understand how to use Ubuntu Server, from initial deployment to creating production-ready resources for your network. The book begins with the concepts of user management, group management, and file system permissions. Continuing into managing storage volumes, you will learn how to format storage devices, utilize logical volume management, and monitor disk usage. Later, you will learn how to virtualize hosts and applications, which will include setting up QEMU & KVM, as well as containerization with both Docker and LXD. As the book continues, you will learn how to automate configuration with Ansible, as well as take a look at writing scripts. Lastly, you will explore best practices and troubleshooting techniques when working with Ubuntu Server that are applicable to real-world scenarios.

By the end of this Ubuntu Server book, you will be well-versed in Ubuntu server’s advanced concepts and attain the required proficiency needed for Ubuntu Server administration.

Publication date:
December 2020


Deploying Ubuntu Server

Ubuntu Server is an extremely powerful distribution of Linux for servers and network appliances. Whether you're setting up a high-end database or a small office file server, the flexible nature of Ubuntu Server will meet and surpass your needs. In this book, we'll walk through all the common use cases to help you get the most out of this exciting platform. Ubuntu Server features a perfect mix of modern development frameworks and rock-solid stability, and its hardware support enables it to be installed on the latest server hardware.

In this chapter, I'll guide you through the process of deploying Ubuntu Server from start to finish. We'll begin with some discussion of best practices, and then we'll obtain the software and create our installation media. Next, I'll give you a step-by-step rundown of the entire installation procedure. By the end of this chapter, you'll have an Ubuntu Server installation of your own to use throughout the remainder of this book. In addition, since Canonical (the makers of Ubuntu) now offer full support for Raspberry Pi with Ubuntu 20.04, we'll look at the process of setting that up as well.

In this chapter, we will cover:

  • Technical requirements
  • Determining your server's role
  • Setting up our server
  • Obtaining installation media
  • Creating a bootable flash drive
  • Installing Ubuntu Server
  • Installing Ubuntu Server on a Raspberry Pi

To get started, we'll first take a look at some of the technical requirements for deploying a server with Ubuntu.


Technical requirements

To follow along with the examples in this book, you'll need an Ubuntu Server installation to work with. In general, the following specifications are the estimated minimums to successfully install Ubuntu Server:

  • 64-bit CPU
  • 1GB RAM
  • 10GB hard disk (16GB or more is recommended)

64-bit CPU support is now a requirement, as Canonical no longer makes versions of Ubuntu available for 32-bit processors (with the only exception being older models of the Raspberry Pi). While this may seem like a surprising requirement, all computers sold today support 64-bit operating systems, and consumer CPUs have been 64-bit capable since at least 2003. Even if you have an older PC lying around that you don't think is capable of running a 64-bit operating system, you'd be surprised—even the later models of the Pentium IV (which is quite old) supports this, so this requirement shouldn't be hard to meet. Don't worry about the particulars of this right now, we'll go through the requirements in more detail later on in this chapter.

Now that we understand the technical requirements of Ubuntu Server, let's consider the role our server will play in our organization.


Determining your server's role

While at this point your goal is most likely to set up an Ubuntu Server installation for the purposes of following along with the examples contained within this book, it's also important to understand how a typical server rollout is performed in the real world. Every server must have a purpose, or role. This role could be that of a database server, web server, file server, and so on. In a nutshell, the role is the value the server adds to you or your organization. Sometimes, servers may be implemented solely for the purpose of testing experimental code. And this is important too—having a test environment is a very common (and worthwhile) practice.

Once you understand the role your server plays within your organization, you can plan for its implementation. Is the system mission critical? How would it affect your organization if for some reason this server malfunctioned? Depending on the answer to this question, you may only need to set up a single server for this task, or you may wish to plan for redundancy such that the server doesn't become a central point of failure. An example of this may be a DNS server, which would affect your colleagues' ability to resolve local hostnames and access required resources. It may make sense to add a second DNS server to take over in the event that the primary server becomes unavailable for some reason.

Another item to consider is how confidential the data residing on a server is going to be for your environment. This directly relates to the installation procedure we're about to perform, because you will be asked whether or not you'd like to utilize encryption. The encryption that Ubuntu Server offers during installation is known as encryption at rest, which refers to the data stored within the internal storage volumes on that server. If your server is destined to store confidential data (accounting information, credit card numbers, employee or client records, and so on), you may want to consider making use of this option. Encrypting your hard disks is a really good idea to prevent miscreants with local access from stealing data. As long as the attacker doesn't have your encryption key, they cannot steal this confidential information. However, it's worth mentioning that anyone with physical access can easily destroy data (encrypted or not), so remember to keep your server room locked!

At this point in the book, I'm definitely not asking you to create a detailed implementation diagram or anything like that, but instead to keep in mind some concepts that should always be part of the conversation when setting up a new server. It needs to have a reason to exist, it should be understood how critical and confidential the server's data will be, and the server should then be set up accordingly. Once you practice these concepts as well as the installation procedure, you can make up your own server roll-out plan to use within your organization going forward. All in all, understanding the purpose of each component in your infrastructure is a great mindset to adopt.

At this point, we now understand how we might identify a role for our server and how it may fit in with our organization. In the next section, we'll take a look at the process of actually installing Ubuntu Server, so we will have at least one test machine to use for the examples in this book.


Setting up our server

Now it's time to set up an installation of Ubuntu Server to use for the examples in this book. But before we can do that, we have to decide what to actually install it on. For the purposes of this book, there isn't a specific requirement in terms of hardware. You just need an Ubuntu Server installation of some sort, and it wouldn't hurt to set up multiple servers if you can—you don't need them all to be on the same device type. Having multiple servers will help you experiment with networking when we get to that point later on in the book. But for now, it's only a matter of utilizing whatever you have at your disposal to get an Ubuntu installation going.

In particular, the following list includes the most common devices you can consider for your Ubuntu Server installation:

  • Virtual machine
  • Physical server
  • Virtual private server
  • Spare desktop or laptop
  • Raspberry Pi

Let's take a look at each of these options in more detail.

Virtual machine

Most computers sold nowadays support Virtual Machines (VMs). VirtualBox is a great solution, as it's easy to use and available for all of the major operating systems. Just like Ubuntu itself, VirtualBox is available for free, so it's typically the lowest-cost entry-point for getting started. Also, VirtualBox allows you to easily create snapshots of your Ubuntu installation, so you can create a point-in-time backup before going through an example in this book, and then restore it to repeat tasks as often as you'd like. The downside to VirtualBox is that you'll need to be able to dedicate at least 1 GB of RAM to your Ubuntu Server VM, and your CPU will need to support virtualization extensions, which you'll need to enable in your computer's settings if your device supports it.

VirtualBox can be downloaded here:

Physical server

Nowadays, it's very easy to find used physical servers for an affordable price. Dell PowerEdge is a very common model, and the R610 and R710 specifically are good choices that are readily available. These servers are commonly made available in the reseller market after companies upgrade to newer models. The R610 and R710 are a bit old, but their specs are still great for testing purposes. The downside with physical servers is that they take up a lot of room and can often be power-hungry. Make sure to shut them down when not in use and look into the cost of electric services in your area—these servers can be very cheap to run or very expensive, depending on your electricity rates.

Virtual private server

Services such as Amazon Web Services, Google Cloud, Linode, Microsoft Azure, Digital Ocean, and others allow you to set up Ubuntu Server in the cloud for you to connect to and manage via OpenSSH. Choosing the Virtual Private Server (VPS) option has some benefits; you don't need to find room for a large physical server, and you don't need to worry about power usage either. Another benefit is that you won't even need to go through the installation process in this chapter at all; the cloud provider will do that for you when you choose to deploy Ubuntu Server on their platform. The main downside, though, is that VPSes are not free—you'll need to look at the costs associated with running Ubuntu on such a server and decide if that cost makes sense. Some VPS services allow you to set up instances for as little as 5 USD per month, which can be lower than the cost of the electricity needed to run a physical server in some areas.

Spare desktop or laptop

Did you just buy a new computer? Don't throw the old one away, you can re-purpose it! Spare desktops and laptops make great devices for testing Ubuntu Server. If the device is a laptop, then you benefit from a built-in Uninterruptible Power Supply (UPS) if the battery still holds a charge. With a built-in screen and keyboard, as well as lower power usage, these can be a convenient choice for acting as a test server. In fact, laptops and desktops typically support virtualization, so you'll be able to set up a VM server on these, and running containers (such as with Docker) isn't outside the realms of possibility either.

Raspberry Pi

Raspberry Pi units are quickly becoming a user favorite for several use cases. They are inexpensive (some models are available for less than 50 USD) and they also use very minimal electricity—you can leave them powered on 24/7 with a virtually unnoticeable difference in your power bill. In fact, they use about as much power as it takes to charge a high-end cellphone. Another benefit is that a Raspberry Pi is generally going to be more powerful than an entry-level VPS. The cheapest VPS instances typically have just 1 CPU core and 1 GB of RAM, but modern Raspberry Pis are produced with quad-core CPUs, as well as 2 GB, 4 GB, or 8 GB of RAM depending on which model you purchase. This means that a Raspberry Pi can possibly perform better than cheaper VPS instances. The downside to Raspberry Pi is that some applications are unavailable, since they utilize ARM CPUs instead of x86. This means that some examples in this book will not work on a Pi (although the majority will).

Once you've chosen a device to install Ubuntu Server on, we can continue. If you chose to utilize a VPS, you can move on to the next chapter, Chapter 2, Managing Users and Permissions, as you won't need to walk through the installation process. In the case of the Raspberry Pi, if that's your chosen platform, you can skip to the end of this chapter for a dedicated section about setting that up. For all other devices, continue reading for a walk-through for the Ubuntu Server Live Installer.


Obtaining installation media

It's time to get started! If you've decided to utilize a physical server, desktop, laptop, or VM as your test server, then you'll need to go through the installation process to set up Ubuntu. Don't worry—it's very easy to do and is made even easier in Ubuntu 20.04 as there are fewer overall steps in the process. If you've instead opted to use a VPS or Raspberry Pi, you won't need to go through this process, as VPS providers do this for you and Raspberry Pi has a different setup method altogether (we'll cover this later in the chapter, in the Installing Ubuntu on a Raspberry Pi section).

Assuming that you've decided to use a device that does require going through the installer, we'll need to download Ubuntu Server and then create bootable installation media to install it. How you do this largely depends on your hardware. Does your device have an optical drive? Is it able to boot from USB? Refer to the documentation for your device to find out.

It's recommended to utilize a flash drive for the installation if you can, preferably one that uses USB 3.0 or higher since you'd benefit from its faster speed compared to USB 2.0. The reason for the preference toward using a flash drive is due to the fact that they are typically faster than a DVD.

However, if your device is older, you won't have a choice, as legacy devices were not able to boot from USB at all. As a general rule, use a flash drive if you can and opt for a DVD only if you have no choice.

In the past, Ubuntu Server ISO images could be used to create either a bootable CD or DVD. Nowadays, writable CDs don't have enough space to support the download size. Therefore, if you choose to burn bootable optical media, you'll need a writable DVD at a minimum.

Unfortunately, the differing age of servers within a typical data center introduces some unpredictability when it comes to how to boot installation media. When I first started with servers, it was commonplace for all standard rack servers to contain a 3.5-inch floppy disk drive, and some of the better ones even contained an optical drive. Nowadays, servers typically contain neither. If a server does have an optical drive, it could potentially go unused for an extended period of time and become faulty without anyone knowing until the next time someone goes to use it. Some servers boot from USB, others don't. To continue, check the documentation for your hardware and plan accordingly. Your server's capabilities will determine which kind of media you'll need to create.

Regardless of whether we plan on creating a bootable USB or DVD, we only need to download a single file. Navigate to the following site in your web browser to get started:

From this page, we're going to download Ubuntu 20.04 LTS by clicking on the Download button:

Figure 1.1: Ubuntu Server 20.04.1 download page

There may be other versions of Ubuntu Server listed on this page, such as 20.10 and 21.04, depending on when you're reading this. New releases of Ubuntu are published every six months. However, this book only covers the Long Term Support (LTS) release, due to the fact that it benefits from five years of support (non-LTS versions are only supported for nine months).

Organizations don't typically utilize non-LTS releases at all, except for testing upcoming features prior to general availability, so for our purposes, we'll stick with the LTS version. Once the download is completed, we'll end up with an ISO image we can use to create our bootable installation media.

If you're setting up a VM, then the ISO file you download from the Ubuntu downloads page will be all you need; you won't need to create a bootable DVD or flash drive. In that scenario, all you should need to do is create a VM, attach the ISO to the virtual optical drive, and boot it. From there, the installer should start, and you can proceed with the installation procedure outlined later in this chapter, in the Installing Ubuntu Server section. Going over the process of booting an ISO image on a VM differs from one virtualization solution to another, so detailing the process on each would be beyond the scope of this book. Thankfully, the process is usually straightforward and you can find the details within the documentation of your hypervisor or from performing a quick Google search. In most cases, the process is as simple as attaching the downloaded ISO image to the VM and then starting it up.

If your device does not support booting from USB and you find yourself needing to create a bootable DVD, the process is typically just a matter of downloading the ISO file and then right-clicking on it. In the right-click menu of your operating system, you should have an option to burn to disk or some similar verbiage. This is true of Windows, as well as most graphical desktop environments of Linux where a disk-burning application is installed.

The exact procedure differs from system to system, mainly because there is a vast amount of software combinations at play here. For example, I've seen many Windows systems where the right-click option to burn a DVD was removed by an installed CD/DVD-burning application. In that case, you'd have to first open your CD/DVD-burning application and find the option to create media from a downloaded ISO file. As much as I would love to outline the complete process here, no two Windows PCs typically ship with the same CD/DVD-burning application. The best rule of thumb is to try right-clicking on the file to see whether the option is there, and, if not, refer to the documentation for your application. Keep in mind that a data disk is not what you want, so make sure to look for the option to create media from an ISO image or your disk will be useless.

At this point, you should have an Ubuntu Server ISO image file downloaded. If you are planning on using a DVD to install Ubuntu, you should have that created as well. In the next section, I'll outline the process of creating a bootable flash drive that can be used to install Ubuntu Server.


Creating a bootable flash drive

The process of creating a bootable USB flash drive with which to install Ubuntu used to vary greatly between platforms. The steps were very different depending on whether your workstation or laptop was currently running Linux, Windows, or macOS. Thankfully, a much simpler method has come about. Nowadays, I recommend the use of Etcher to create your bootable media. Etcher is fantastic in that it abstracts the method such that it is the same regardless of which operating system you use, and it distills the process to its most simple form.

Another feature I like is that Etcher is safe; it prevents you from destroying your current operating system in the process of mastering your bootable media. In the past, you'd use tools like the dd command on Linux to write an ISO file to a flash drive. However, if you set up the dd command incorrectly, you could effectively write the ISO file over your current operating system and wipe your entire hard drive. Etcher doesn't let you do that.

Before continuing, you'll need a USB flash drive that is either empty or one you don't mind wiping. This process will completely erase its contents, so make sure the device doesn't have information on it that you need. The flash drive should be at least 1 GB, preferably 2 GB or larger. Considering it's difficult to find a flash drive for sale with less than 4 GB of space nowadays, this should be relatively easy to obtain.

To get started, head on over to, download the latest version of the application from their site, and open it up. The window will look similar to the following screenshot once it launches:

Figure 1.2: Utilizing Etcher to create a bootable flash drive

At this point, click Flash from file, which will open up a new window that will allow you to select the ISO file you downloaded earlier. Once you select the ISO, click on Open:

Figure 1.3: Selecting an ISO image with Etcher

If your flash drive is already inserted into the computer, Etcher should automatically detect it. In the event that you have more than one flash drive attached, or Etcher selects the wrong one, you can click Change and select the flash drive you wish to use:

Figure 1.4: Selecting a different flash drive with Etcher

Finally, click Continue to get the process started. At this point, the flash drive will be converted into Ubuntu Server installation media that can then be used to start the installation process:

Figure 1.5: Etcher in the progress of writing a flash drive

After a few minutes (the length of time varies depending on your hardware), the Flashing process will complete, and you'll be able to continue and get some installations going. Before we get into that, though, we should have a quick discussion regarding partitioning.

Planning the partitioning layout

Partitioning your disk allows you to divide up your hard disk to dedicate specific storage allocations to individual applications or purposes. For example, you can dedicate a partition for the files that are shared by your Apache web server so changes to other partitions won't affect it. You can even dedicate a partition for your network file shares—the possibilities are endless. Each partition is mounted (attached) to a specific directory, and any files sent to that directory are thereby sent to that separate partition. The names you create for the directories where your partitions are mounted are arbitrary; it really doesn't matter what you call them. The flexible nature of storage on Linux systems allows you to be creative with your partitioning as well as your directory naming, since the Linux filesystem gives you more flexibility when it comes to mounting storage devices in specific folders.

Admittedly, we're getting ahead of ourselves here. After all, we're only just getting started and the point of this chapter is to help you set up a basic Ubuntu Server installation to serve as the foundation for the rest of the chapter. When going through the installation process, we'll accept the defaults anyway. However, the goal of this section is to give you examples of the options you have for consideration later. At some point, you may want to get creative and play around with the partition layout.

With custom partitioning, you're able to do some very clever things. For example, with the right configuration, you'll be able to wipe and reload your distribution while preserving user data, logs, and more. This works because Ubuntu Server allows you to carve up your storage any way you want during installation. If you already have a partition with data on it, you can choose to leave it as is so you can carry it forward into a new install. You simply set the directory path where it's mounted to be the same as before, restore your configuration files, and your applications will continue working as if nothing happened.

One very common example of custom partitioning in the real world is separating the /home directory into its own partition. Since this is where users typically store their files, you can set up your server such that a reload of the distribution won't disturb their files. When they log in after a server refresh, all their files will be right where they left them. You could even place the files shared by your Apache web server on to their own partition and preserve those too. You can get very creative here.

It probably goes without saying, but when reinstalling Ubuntu, you should back up partitions that have data you don't want to be wiped (even if you don't plan on formatting the partitions). The reason being, one wrong move (literally a single checkbox) and you can easily wipe out all the data on that partition. Always back up your data when refreshing a server.

Another reason to utilize separate partitions may be to simply create boundaries or restrictions. If you have an application running on your server that is prone to filling up large amounts of storage, you can point that application to its own partition, limited by size. An example of where this could be useful is an application's log files. Log files are the bane of any system administrator's life when it comes to storage. While helpful if you're trying to figure out why something crashed, logs can fill up a hard disk very quickly if you're not careful. In my experience, servers have been known to come to a screeching halt due to log files filling up all the available free space on a server where everything was on a single partition. The only boundary the application had was the entirety of the disk itself.

While there are certainly better ways of handling excessive logging (log rotating, disk quotas, and so on), a separate partition would certainly help. If the application's log directory was on its own partition, it would be able to fill up that partition, but not the entire drive, which would cause issues but wouldn't affect the entire server. As an administrator, it's up to you to weigh the pros and the cons of these strategies to avoid server overload and develop a partitioning scheme that will best serve the needs of your organization.

Success when maintaining a server is a matter of efficiently managing resources, users, and security—a good partitioning scheme is certainly part of that. Sometimes it's just a matter of making things easier on yourself so that you have less work to do should you need to reload your operating system. For the sake of following along with this book, it really doesn't matter how you install or partition Ubuntu Server. The trick is simply to get it installed—you can always practice partitioning later. After all, part of learning is setting up a platform, observing any issues that may occur, and then fixing it up.

Here are some basic tips regarding partitioning:

  • At a minimum, a partition for the root filesystem (designated by a forward slash) is required.
  • The /var directory contains most log files and is therefore a good candidate for separation for the reasons mentioned previously in this section.
  • The /home directory stores all user files. Separating this into a separate partition can be beneficial as it gives you the possibility of having your user files survive a reinstall of Ubuntu.
  • If you've used Linux before, you may be familiar with the concept of a swap partition, which is a special partition that can act as RAM when your memory becomes full. This is no longer necessary—a swap file will be created automatically in newer Ubuntu releases.

When we perform our installation in the next section, we'll choose the defaults for the partitioning scheme to get you started quickly. However, I recommend you come back to the installation process at some point in the future and experiment with it. You may come up with some clever ways to split up your storage. However, you don't have to—having everything in one partition is fine too, depending on your needs.

Now that we have an understanding of what partitioning is, we should have all of the essential topics covered to enable us to actually get the installation of Ubuntu Server going. Let's go ahead and work on that now.


Installing Ubuntu Server

At this point, we should be ready to get an installation of Ubuntu Server going. In the steps that follow, I'll walk you through the process.

Installing media

To get started, all you should need to do is insert the installation media into your server or device and follow the onscreen instructions to open the boot menu. The key you press at the beginning of the POST process differs from one machine to another, but it's quite often F10, F11, or F12. Refer to your documentation if you are unsure, though most computers and servers tell you which key to press at the beginning. You may miss this window of opportunity the first few times, and that's fine—to this day I still seem to need to restart the machine once or twice to hit the key in time.

When you first boot from the Ubuntu Server install media, you'll see an icon near the bottom that looks like the following (it will go away after a few seconds):

Figure 1.6: This icon indicates other options are available

This icon is your indication that you can press Enter here to select additional options, such as your language. If you don't press Enter within a few seconds, the installer will proceed automatically with the default options (such as setting the language to English). If you do press Enter, you'll see a screen something like the following screenshot:

Figure 1.7: Language selection at the beginning of the installation process

If your language is anything other than English, you'll be able to select that here. You can also press F6 to view Other Options, which you would only explore in a situation in which your hardware wasn't working properly. Most people won't need to do this, however.

After choosing your language, you'll be brought to the installation menu. (If you didn't press Enter when the previously mentioned icon was on the screen, this screen will be bypassed and you won't see it). The installation menu will give you additional options. To start the installation process, press Enter to choose the first option (Install Ubuntu Server), though a few of the other options may be useful to you:

Figure 1.8: Main menu of the Ubuntu installer

First, this menu also offers you an option to install Ubuntu with safe graphics mode enabled. Normally, you shouldn't need this option. If you have any trouble with the installer (such as not being able to see anything on the screen after the installer starts), then this option may be something you'd want to try. If you aren't having any problems at all, you can ignore this.

Second, this menu gives you the option to Test memory. This is an option I've found myself using far more often than I'd like to admit. Defective RAM on computers and servers is surprisingly common and can cause all kinds of strange things to happen. For one, defective RAM may cause your installation to fail. Worse, your installation could also succeed—and I say that's worse due to the fact you'd find out about problems later (after spending considerable time setting it up) rather than right away. The following image shows a memory test in progress:

Figure 1.9: Memory test in progress

While doing a memory test can add considerable time to the installation process, I definitely recommend it on physical servers, especially if the hardware is new and hasn't been tested. In fact, I make it a practice to test the RAM of all my servers once or twice a year, so any installation media you create can be used as a memory tester any time you need one.

The memory test can take a very long time to complete (multiple hours) depending on how much RAM your server has. As a general rule of thumb, I've found that if there are issues with your server's memory, it will typically find the problem in fewer than 15 minutes. Press Esc to abort the test.

Boot from first hard disk, pictured in Figure 1.8, allows you to boot from the first hard disk, which is typically an existing operating system. If you left the installation media in the PC after the installation was finished, you can choose this option to attempt to boot the existing OS.

From this point forward, we will progress through the various screens to customize our installation. I'll guide you along the way.

Customizing the installation

To navigate the installer, you simply use the arrow keys to move up and down to select different options, and press Enter to confirm choices. The Esc key will allow you to exit from a sub-menu. The installer is pretty easy to navigate once you get the hang of it. Anyway, after you enter the actual installation process, the first screen will ask you to select a language. Go ahead and do so:

Figure 1.10: Language selection screen

You may have noticed that the file name for the ISO file you downloaded included the term "live." At the next screen, you'll see why—if there's a new version of the installer available, you will see an offer to download the latest version. This will ensure that any bugs or vulnerabilities discovered later are fixed and won't become part of your installation. If you do see this option, it's highly recommended to allow it to download the fresh install program:

Figure 1.11: Installer update prompt

If an update is found and you agree to install it, the new installer should download very quickly and then you'll be good to go:

Figure 1.12: Installing an installer update

The next screen will allow you to choose your keyboard layout. If you use a keyboard other than an English (US) keyboard, you can select that here. Press the down key to highlight Done and press Enter when you've finished:

Figure 1.13: Choosing a keyboard layout

At the next screen, you'll be given a chance to set up your network connection. The default is set to DHCP, and you'll see an IP address here if the initial connection was successful. If your network doesn't automatically connect, follow the next few steps and change the connection to Automatic (DHCP), as shown in Figure 1.16. If DHCP is acceptable to you, you can simply accept the defaults and select Done to continue along:

Figure 1.14: Ubuntu Server network connection setup screen

If you'd like to set up a static IP address, you can highlight the network card and press Enter, and then you can select Edit IPv4 to begin the process of customizing your connection:

Figure 1.15: Selecting a network card and beginning the process of setting a custom IP address

At the next screen, select Manual to move on to the next step:

Figure 1.16: Static IP assignment (continued)

At the next screen, you'll be able to enter all the details specific to your network connection in order to set up your static IP assignment. When finished, select Save:

Figure 1.17: Entering network connection details

Next, the installer will give you an opportunity to enter your Proxy address, if you have one. Most readers will arrow down to done and press Enter to skip this, but if you do have an actual proxy, enter that here:

Figure 1.18: Ubuntu installer proxy prompt

Next, you'll be prompted to enter a Mirror address that will be used for Ubuntu's package manager (apt). Leave this URL as-is, and select Done to continue:

Figure 1.19: Selecting a mirror for Ubuntu Server's package manager

The next section will give you a chance to configure your server's disk.

Configuring the server's disk

If you want to implement a custom partitioning scheme, as discussed earlier in the Planning the partitioning layout section, you can do that in the following screen. The Custom storage layout option will allow you to do just that. However, that is beyond the scope of this chapter, as we're just trying to get an installation off the ground, so choose Use an entire disk to continue:

Figure 1.20: Disk setup screen of the Ubuntu Server installer

After selecting Use an entire disk, the next screen will show you a summary of the disk operations that will be performed. Select Done to continue with the default selections. Keep in mind that your disk will be erased as part of this process:

Figure 1.21: Showing a summary of disk operations during installation

To be doubly sure that you understand that the disk will be wiped and you're okay with that, the installer will show you another warning. Choose Continue at the following screen to move on:

Figure 1.22: Final confirmation before writing changes to disk

Next, you'll then be brought to a screen where you can enter information related to the initial user account.

Creating the initial user account

When we install Ubuntu Server, it will create an initial user account for us as part of the process. This user will be used for configuring and maintaining the server after installation. In this section of the installer, we'll be given an opportunity to name this user and create a password.

Fill out your information on this screen, as I have in the following screenshot. One important thing to keep in mind is that the user you create here will have administrative access. You can always create other users later on, but the user you create here will have special privileges. When finished, arrow down to Done and press Enter:

Figure 1.23: Entering details for the initial user account

Next, you'll be given an option to install OpenSSH, which I recommend you do. This will allow you to easily connect to your server to perform remote management. OpenSSH is the gold standard for remote access in Linux and UNIX, so it will definitely be useful to have. Select Done to continue:

Figure 1.24: Choosing to install OpenSSH during the installation of Ubuntu

Although it's beyond the scope of this chapter, the new Ubuntu Server 20.04 installer allows you to import an SSH key from GitHub or Launchpad. Keep in mind that this feature exists, as that may be something you'll want to utilize later as it can simplify remote access. At the next screen, you'll see a large selection of additional applications that can be installed. We'll set up everything we need in this book manually as we get to each topic, so select Done to continue for now:

Figure 1.25: Featured application selection

That's pretty much it—the installer will continue along on its own, as it has all the information it needs from you at this point. Once it's done, you'll see an option to Reboot at the bottom of the screen; go ahead and select that:

Figure 1.26: Ubuntu Server setup is now complete and you are ready to restart into a fresh installation

At this point, your server will reboot and then Ubuntu Server should start right up. Congratulations! You now have your own Ubuntu Server installation!

In addition to a physical device, Ubuntu Server can also be installed on a Raspberry Pi, and that's exactly what we'll take a look at in the next section.


Installing Ubuntu on a Raspberry Pi

The Raspberry Pi platform has become quite a valuable asset in the industry, and a useful server platform. These tiny computers, now with four cores and up to 8 GB of RAM, are extremely power efficient and their performance is good enough that you can actually transform them into actual servers. In my lab, I have several Raspberry Pis on my network, each one responsible for performing specific tasks or functions. In many cases, you wouldn't even tell that they were devices with lower-powered hardware. Perhaps even more surprising is the fact that the Raspberry Pi 4 can outperform some lower-tier cloud instances, giving you a powerful server without the monthly cost if you don't need a high-end CPU. All this, in such a small form factor—these devices are smaller than the coaster under your coffee mug!

Ubuntu Server is available for Raspberry Pi models 2, 3, and 4. To get started, all you'll need to do is visit the official download page for the Raspberry Pi version of Ubuntu, here: This will take you to the following screen:

Figure 1.27: The download section for Raspberry Pi on the official Ubuntu website

Once there, you'll see a listing of multiple versions for the Pi that are available for download. Refer to the preceding screenshot for an example of options that are available, but keep in mind that Ubuntu may redesign their web page at any time. So as a rule of thumb, download the version that matches the type of Raspberry Pi you have, and go with the 64-bit version if it's available (the Raspberry Pi 2 only has a 32-bit option available).

The download for the Pi versions will come in the form of a compressed image, which can be written directly to an SD card. To get the process going, open up Etcher, which we downloaded in an earlier step. Once Etcher is open, click Flash from file:

Figure 1.28: Etcher, ready for action

Now, choose the file that was downloaded earlier and select Open:

Figure 1.29: Selecting the file to use to write to the SD card

Next, go ahead and insert an SD card into your computer that will become dedicated to Ubuntu Server. Etcher will completely erase the SD card, so make sure you don't care about any data that may be on it. If your computer does not have an SD card slot, you can use a USB card reader. If the proper device isn't selected, you can click Select target to choose the SD card to use, as shown in Figure 1.28. Then click Continue:

Figure 1.30: Choosing an SD card to use with Etcher for the Raspberry Pi

Once you've selected both the image file to use and the target SD card, you're ready to proceed. Click Flash! to begin the process of writing the image:

Figure 1.31: Etcher, ready to start flashing the SD card

Now, Etcher will prepare the target with the source image file. The process can take anywhere from 5 to 15 minutes depending on the speed of your hardware:

Figure 1.32: Etcher in progress

Once Etcher is finished writing to the SD card, you can eject it from your computer and insert it into the Pi, which can be accessed remotely via SSH. When it finishes booting for the first time, you can log in and begin using it as you would any other Ubuntu Server installation (the username and password both default to ubuntu). From there, you can create a new user for yourself, install applications, and experiment.



In this chapter, we covered a couple of different installation processes in great detail. As with most Linux distributions, Ubuntu Server is scalable and able to be installed on a variety of server types. Physical devices, VMs, and even the Raspberry Pi have versions of Ubuntu available. The process of installation was covered step by step, and you should now have an Ubuntu Server instance of your own to configure as you wish. Also in this chapter, we covered determining the role of your server, the process of creating bootable media, and a walk-through of setting up Ubuntu Server on a Raspberry Pi. You're now on your way to Ubuntu Server mastery.

In the next chapter, we'll show you how to manage users. You'll be able to create them, delete them, change them, and even manage password expiration and more. We will also cover permissions so that you can determine what your users are allowed to do on your server. See you there!


Further Reading

About the Author

  • Jay LaCroix

    Jeremy "Jay" LaCroix is a technologist and open-source enthusiast, specializing in Linux. He has a net field experience of 20 years across different firms as a Solutions Architect and holds a master's degree in Information Systems Technology Management from Capella University. In addition, Jay also has an active Linux-focused YouTube channel with over 250K followers and over 20M views, available at LearnLinuxTV, where he posts instructional tutorial videos and other Linux-related content. He has also written Linux Mint Essentials and Mastering Linux Network Administration, published by Packt Publishing.

    Browse publications by this author

Latest Reviews

(4 reviews total)
I learned a lot of new things from this book.
Buenos libro y a la última. Muy contento.
Excellent, smooth experience !

Recommended For You

Mastering Ubuntu Server - Third Edition
Unlock this book and the full library FREE for 7 days
Start now