Search icon
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Learning Hub
Free Learning
Arrow right icon
Over 7,000 tech titles at $9.99 each with AI-powered learning assistants on new releases
Mastering Ubuntu Server. - Second Edition
Mastering Ubuntu Server. - Second Edition

Mastering Ubuntu Server.: Master the art of deploying, configuring, managing, and troubleshooting Ubuntu Server 18.04, Second Edition

By Jay LaCroix
$39.99 $9.99
Book May 2018 552 pages 2nd Edition
$39.99 $9.99
$15.99 Monthly
$39.99 $9.99
$15.99 Monthly

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details

Publication date : May 30, 2018
Length 552 pages
Edition : 2nd Edition
Language : English
ISBN-13 : 9781788997560
Concepts :
Table of content icon View table of contents Preview book icon Preview Book

Mastering Ubuntu Server. - Second Edition

Deploying Ubuntu Server

Ubuntu Server is an extremely powerful distribution 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. In this chapter in particular, I'll guide you through the process of deploying Ubuntu Server on to your system. We'll start off with some discussion on 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. I'll even show you the process of installing Ubuntu Server on a Raspberry Pi 3 for good measure.

In particular, we will cover:

  • Setting up our lab
  • Determining your server's role
  • Deciding between 32- and 64-bit installations
  • Obtaining Ubuntu Server installation media
  • Creating a bootable Ubuntu Server flash drive
  • Planning the partition layout
  • Installing Ubuntu Server
  • Installing Ubuntu Server on Raspberry Pi 3

Technical requirements

For this chapter (and all others) we will need either a physical computer or virtual machine with the following specs:

  • One CPU core
  • 512 MB RAM
  • 10 GB hard disk (16 or more recommended)

Don't worry about the specifics for now; we will discuss these requirements further in this chapter.

Setting up our lab

The first thing for us to do is to set up our environment. For the purposes of this book, it really doesn't matter what kind of hardware you use, if you even use physical hardware at all (a virtual machine or cloud instance will suffice). If you have physical server hardware available to you, then by all means use it (though not everyone has the money or even the available space to set up a complete lab). Nowadays, processing power and memory is cheaper than it's ever been, and the typical home PC is capable of running several virtual machines. Even better, software such as VirtualBox is free, so even if you have no budget at all, there are definitely options available to you. Perhaps you already have a server or two in your rack at work just waiting to be deployed; in which case, this will be even more exciting and fun. In the case of VirtualBox, it can be downloaded from here:

While I always prefer physical hardware, virtual machines have one major advantage. Not only are they easy to create and destroy at will, they are perfect for testing new or proposed solutions because you can easily take a snapshot of a VM and restore it if an experiment blows up in your face. In my case, it's common for me to create a virtual machine of a Linux distribution, fully update it, and then take a snapshot before making any changes. That way, I always have a base version of the OS to fall back on if I muck it up. Testing software rollouts on virtual machines before graduating a solution to production is a good habit to get into anyway.

This book makes no assumptions regarding your environment, because the hardware you have access to differs from person to person. While the installation procedure for Ubuntu Server differs based on hardware (for example, perhaps your server isn't capable of booting from USB install media, forcing you to use a DVD), all other concepts contained throughout the book will be the same regardless.

With that said, once we run through the install procedure, feel free to install Ubuntu Server on as many devices or VMs as you can. Later on in our journey, we'll go through several examples of networking, including copying files from one server to another. If you have more than one installation, these exercises will be easier. You can set up multiple virtual machines, physical servers, or any combination of the two.

If you don't have access to a physical server, and your PC isn't powerful enough to handle virtual machines very well, consider setting up a Virtual Private Server (VPS) from providers such as Linode and DigitalOcean, which both have Ubuntu Server available as an option for a small monthly fee. See the following URLs for more information on two popular VPS providers:

Cloud providers are great if you wish to get a server up and running quickly or if your goal is to set up a server to be available in the cloud. With that said, all you need to do is have Ubuntu Server installed on something (basically anything at all) and you're ready to follow along.

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 concepts 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, also known as its role. This role could be that of a database server, web 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 importance. 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 colleague's 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 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 miscreant 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 definitely keep your server room locked!

At this point in the book, I'm definitely not asking you to create a detailed flow chart 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.

Deciding between 32- and 64-bit installations

Before we grab our installation media and get started, I thought I would write a bit about the diminishing availability of 32-bit installation media in the Linux world. When the first edition of this book was published, I wrote about the choice between 32- and 64-bit installations. Nowadays, whether to use 64-bit installation media is no longer much of an option, with various distributions of Linux dropping support for 32-bit downloads. In the case of Ubuntu Server 18.04, you are now only able to download 64-bit installation images as 32-bit downloads of Ubuntu Server have been removed.

This may seem like a polarizing decision on Canonicals' part, but it's really not as bad as it may seem. Not being able to download 32-bit installation images from Canonical doesn't mean that you can't run 32-bit software; it just means that your overall system will be running a 64-bit kernel. This is great, considering you'll benefit fully by being able to more efficiently utilize the RAM in your server.

In addition, 64-bit capable processors have been on the market for well over a decade. Even if you think your hardware may be too old to utilize 64-bit software, it will more than likely support it just fine. Consider this—several versions of the Pentium 4 processor support 64-bit software, and that processor has become ancient history in computer years. One scenario that may suffer due to the decision to decommission 32-bit media is installation on netbooks, but most people don't run server applications from such a device, so that doesn't affect us at all in terms of this book.

All in all, the decision to migrate away from 32-bit is a good move in the name of progress, and it shouldn't impact us at all when setting up new servers. However, I mentioned it here simply because I wanted to make you aware of it. If you are downloading a modern version of Ubuntu Server today, you're downloading the 64-bit version (and you probably won't notice a difference).

Obtaining Ubuntu Server installation media

It's time to get started! At this point, we'll need to get our hands on Ubuntu Server and then create bootable installation media to install it. How you do this largely depends on your hardware. Does your server have an optical drive? Is it able to boot from USB? Refer to the documentation for your server to find out. In most cases, it's a very good idea to create both a bootable DVD and USB media of Ubuntu Server while you're at it. That way, regardless of how your server boots, you'll have what you need.

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 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 and only ship with an optical drive if you ask for one nicely while placing your order. If a server does have an optical drive, it typically will 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 18.04 LTS by clicking on the Download button. There may be other versions of Ubuntu Server listed on this page, such as 18.10 and 19.04, for example. However, we're only interested in 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). Non-LTS releases are useful for testing future software versions, but when in doubt, stick with LTS. Once the download is completed, we'll end up with an ISO image we can use to create our bootable installation media.

The ISO image we just downloaded is known as the live installer. This version is the default, and is preferred for most use cases. However, if you are performing a more advanced installation (such as installing Ubuntu with RAID) you may need the alternative installer instead. If you do need this version, you can get it by clicking on the link for alternative downloads page, and then on the next page you'll see an option for the Alternative Ubuntu Server installer. This special installer is covered in the appendix at the back of the book. Otherwise, we'll continue on with the standard installer.

If you're setting up a virtual machine, 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 case, 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. Going over the process of booting an ISO image on a virtual machine differs from hypervisor to hypervisor, 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 virtual machine, and then starting it up.

As I mentioned before, I recommend creating both a bootable USB and bootable DVD. This is due to the fact that you'll probably run into situations where you have a server that doesn't boot from USB, or perhaps your server doesn't have an optical drive and the USB flash drive is your only option. In addition, the Ubuntu Server boot media also makes great recovery media if for some reason you need to rescue a server. 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 disc or some similar verbiage. This is true of Windows, as well as most graphical desktop environments of Linux when a disc burning application installed. If in doubt, Brasero is a good disc-burning utility to download for Linux, and other operating systems generally have this option built-in nowadays.

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 disc is not what you want, so make sure to look for the option to create media from an ISO image or your disc 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.

Creating a bootable Ubuntu Server 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. In the first edition, I outlined the process on all three major platforms. Thankfully, a much simpler method has come about since the publication of the first edition. 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 OS 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 out everything. 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 it, so make sure the device doesn't have information on it that you'd rather not lose. 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:

Utilizing Etcher to create a bootable flash drive

At this point, you'll click Select image, 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:

Selecting an ISO image with Etcher

If your flash drive is already inserted into the computer, Etcher should automatically detect it:

Etcher with a selected ISO image and flash drive

In the event 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:

Selecting a different flash drive with Etcher

Finally, you can click Flash! 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:

Selecting a different flash drive with Etcher

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

One of the many joys of utilizing Linux for server platforms is how flexible the partitioning is. 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.

Admittedly, we're probably 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're 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 backup partitions that have data you care about (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 backup 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 administrator when it comes to storage. While helpful if you're trying to figure out why something crashed, logs can fill up a hard disk if you're not careful. In my experience, I've seen servers 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.

While there are certainly better ways of handling excessive logging (log rotating, disk quotas, and so on), a separate partition also would have helped. 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. A full log partition will certainly cause issues, but it wouldn't have been able to affect the entire server. As an administrator, it's up to you to weigh the pros and the cons 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—and 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, figuring out how to break it in epic ways, and then fixing it up.

Here are some basic tips regarding partitioning:

  • At minimum, a partition for the root filesystem (designated by a forward slash) is required.
  • The /var directory contains most log files, and is a ripe candidate for separation.
  • The /home directory stores all user files. Separating this into a separate partition can be beneficial.
  • If you've used Linux before, you may be familiar with the concept of a swap partition. 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.

Installing Ubuntu Server

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

To get started, all you should need to do is insert the 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'll probably 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):

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, this will be bypassed and the default options (such as the English language) will be chosen automatically. If you do press Enter, you'll see the following screenshot:

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

Main menu of the Ubuntu installer

First, this menu also offers you an option to Check disc for defects. Although I'm sure you've done well in creating your media, all it takes is for a small corruption in the download and you would end up with invalid media. This is extremely rare—but it does happen from time to time. If you have the extra time, it may make sense to verify your media.

If boot media created from your PC is constantly corrupted or invalid, try creating the media from another machine and test your PC's memory. You can test memory right from the Ubuntu Server installation media.

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. 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 ever been tested at all. In fact, I make it a process to test the RAM of all my servers once or twice a year, so this media 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.

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

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:

Language selection screen

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 down key to highlight Done and press Enter when you've finished:

Choosing a keyboard layout

At the next screen, you will have the option to install Ubuntu Server, or a MAAS region or rack controller. MAAS, or Metal as a Service, is beyond the scope of this book, but it offers some very interesting features, such as additional options for scaling and provisioning your servers. After you become proficient with Ubuntu Server, it may be worth learning later. I have included a link to the documentation for MAAS at the end of this chapter, should you desire to learn more about it. For now, choose the first option, Install Ubuntu:

Choosing to install Ubuntu or a MAAS controller

Next, the installer will automatically try to configure your network connection via DHCP. This is often correct, so you shouldn't need to do anything here unless you have more than one network card and you'd like to use one other than the default. In my case, it defaulted to device enp0s3 (which is correct) but the interface name will be different depending on your hardware. If you do need to change this, you can select the defaulted interface name, press Enter, and select a different one. When you're finished, arrow down to done and press Enter:

Network configuration step of the Ubuntu Server installer

The next screen will give you a chance to configure your server's disk. At this screen, if you want to implement a custom partitioning scheme, you can do that here. The option Manual 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:

Disk setup screen of the Ubuntu Server installer

After selecting Use An Entire Disk, the next screen will allow you to choose a disk on which to install Ubuntu Server. In my case, I only have one disk, and you probably do as well. But if you have more than one, select the drive to be used as the main drive for the distribution. We can always configure any other drives you may have later. In fact, we will take a look at storage volumes in Chapter 3, Managing Storage Volumes. Simply press Enter after highlighting the appropriate disk:

Choosing a disk to install Ubuntu Server on

Next, the Ubuntu installer will give you an overview of the partitioning it will perform. The defaults are fine, so simply press Enter. You'll be asked to confirm one last time; when you are, arrow down to continue and press Enter:

Confirming the default partitioning scheme

At the next screen, you'll fill out information relative to the default user account. Fill out your information on this screen, as I have in the sample 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:

Confirming the default partitioning scheme
While you're in the process of typing in your user info, Ubuntu Server will actually start installing in the background. Talk about being efficient!

At this point, the installation will continue on, and may even be well on its way before you're finished filling out your user information. You'll see a screen similar to the following when everything is finished. Press Enter to reboot the server into the new installation:

Installation is now complete

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

Installing Ubuntu Server on Raspberry Pi 3

The Raspberry Pi 3 has become quite a valuable asset in the industry. These tiny computers, now with four cores and 1 GB of RAM, are extremely useful in running one-off tasks and even offering a great place to test code without disrupting existing infrastructure. In my lab, I have several Pis on my network, each one responsible for performing specific tasks or functions. It's a very useful platform.

Thankfully, Ubuntu Server is quite easy to install on a Raspberry Pi. In fact, it's installed in much the same way as Raspbian, which is the distribution most commonly used on the Pi. Ubuntu Server is available for Raspberry Pi models 2 and 3. All you'll need to do is download the SD card image and then write it directly to your microSD card (your SD card needs to be at least 4 GB). Once you've done that, you can boot the Pi and log in. The default username and password is ubuntu for both.

To get started, you'll first download the SD card image from here:

Then, check that it is compatible with your model of Raspberry Pi. The image will be in a compressed .xz format, which you'll need to extract with your operating system's decompressing utility (in Linux you can use the unxz command, which you get from the xz-utils package).

Next, we do the actual writing of the SD card. For this, we return to our old friend Etcher, which we used earlier in this chapter to master our USB media. Another feature of Etcher is that it allows us to master SD cards for the Raspberry Pi as well. Go ahead and open Etcher, and select the Ubuntu Server Pi image in much the same way as you selected the Ubuntu Server ISO file earlier. Next, make sure your SD card is inserted, and click Flash! and you should be good to go as soon as the process concludes. Once the process finishes, simply insert the SD card into your Pi and power it on. That's all there is to it!


In this chapter, we covered the installation process in great detail. As with most Linux distributions, Ubuntu Server is scalable and able to be installed on a variety of server types. Physical servers, virtual machines, and even the Raspberry Pi, have a version of Ubuntu Server available. The process of installation was covered step by step, and you should now have an Ubuntu Server of your own to configure as you wish. Also in this chapter, we covered partitioning, creating boot media, determining the role of your server, as well as some best practices.

In the next chapter, I'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. I'll also cover permissions so that you can determine what your users are allowed to do on your server. See you there!


In our first chapter, we covered the installation process that will serve as the foundation for the rest of the book. However, there were still some useful concepts that we'll want to remember. Take a look at the following questions and test your knowledge:

  1. Determining your server's _________ will help you plan for its use on your network.
  2. Ubuntu Server installation media is created from an ___ file, which you can download from the Ubuntu website.
  3. Name at least one provider for VPS solutions (if you can name more than one, even better).
  4. What type of encryption is used when encrypting your Ubuntu installation?
  5. What is an LTS release of Ubuntu? Why is it important?
  6. Which tool is useful for creating bootable USB flash drives and optical media for installation?
  7. At minimum, your Ubuntu Server installation requires a partition for ________ .

Further reading

At the end of some chapters, I will list resources you can use to explore additional concepts relative to the content of the chapter. While not required, you should definitely explore them as these resources will go over additional content that didn't fit the scope of the chapter but are still useful for expanding your knowledge even further:

Left arrow icon Right arrow icon

Key benefits

  • • A practical easy-to-understand book that will teach you how to deploy, maintain and troubleshoot Ubuntu Server
  • • Get well-versed with newly-added features in Ubuntu 18.04.
  • • Learn to manage cutting-edge technologies such as virtualization, containers, Nextcloud and more


Ubuntu Server has taken the data centers 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 that leads the way 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. With this book as your guide, you will learn all about Ubuntu Server, from initial deployment to creating production-ready resources for your network. The book begins with the concept of user management, group management, and filesystem 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 cover setting up KVM/QEMU, 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 the book, you will be an expert Ubuntu Server administrator who is well-versed in its advanced concepts.

What you will learn

• Manage users, groups, and permissions • Encrypt and decrypt disks with Linux Unified Key Setup (LUKS) • Set up SSH for remote access, and connect it to other nodes • Add, remove, and search for packages • Use NFS and Samba to share directories with other users • Get to know techniques for managing Apache and MariaDB • Explore best practices and troubleshooting techniques • Get familiar with scripting • Automate server deployments with Ansible

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details

Publication date : May 30, 2018
Length 552 pages
Edition : 2nd Edition
Language : English
ISBN-13 : 9781788997560
Concepts :

Table of Contents

21 Chapters
Preface Chevron down icon Chevron up icon
1. Deploying Ubuntu Server Chevron down icon Chevron up icon
2. Managing Users Chevron down icon Chevron up icon
3. Managing Storage Volumes Chevron down icon Chevron up icon
4. Connecting to Networks Chevron down icon Chevron up icon
5. Managing Software Packages Chevron down icon Chevron up icon
6. Controlling and Monitoring Processes Chevron down icon Chevron up icon
7. Setting Up Network Services Chevron down icon Chevron up icon
8. Sharing and Transferring Files Chevron down icon Chevron up icon
9. Managing Databases Chevron down icon Chevron up icon
10. Serving Web Content Chevron down icon Chevron up icon
11. Learning Advanced Shell Techniques Chevron down icon Chevron up icon
12. Virtualization Chevron down icon Chevron up icon
13. Running Containers Chevron down icon Chevron up icon
14. Automating Server Configuration with Ansible Chevron down icon Chevron up icon
15. Securing Your Server Chevron down icon Chevron up icon
16. Troubleshooting Ubuntu Servers Chevron down icon Chevron up icon
17. Preventing and Recovering from Disasters Chevron down icon Chevron up icon
18. Using the Alternate Installer Chevron down icon Chevron up icon
19. Assessments Chevron down icon Chevron up icon
20. Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Filter icon Filter
Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%

Filter reviews by

No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial


How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to
  • To contact us directly if a problem is not resolved, use
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.