Preface
Ubuntu is an exciting platform. You can literally find it everywhere—desktops, laptops, phones, and especially servers. The server edition enables administrators to create efficient, flexible, and highly available servers that empower organizations with the power of open source. As Ubuntu administrators, we're in a good company—according to W3Techs, Ubuntu is the most widely deployed distribution on the web with regard to Linux. With the release of Ubuntu 18.04, this platform becomes even more exciting!
In this book, we will dive right into Ubuntu Server, and you will learn all the concepts needed to manage your servers and configure them to perform all kinds of neat tasks, such as serving web pages, managing virtual machines, running containers, automating configuration, and sharing data with other users.
We'll start our journey right in the first chapter, where we'll walk through the installation of Ubuntu Server 18.04, which will serve as the foundation for the rest of the book. As we proceed through our journey, we'll look at managing users, connecting to networks, and controlling processes. Later, we'll implement important technologies, such as DHCP, DNS, Apache, MariaDB, and more. We'll even set up our own Nextcloud server along the way.
Finally, the end of the book covers various things we can do to troubleshoot issues, as well as preventing and recovering from disasters.
Who this book is for
This book is intended for readers with intermediate or advanced-beginner Linux skills, who would like to learn all about setting up servers with Ubuntu Server. This book assumes that the reader knows the basics of Linux, such as editing configuration files and running basic commands.
What this book covers
Chapter 1, Deploying Ubuntu Server, covers the installation process for Ubuntu Server. This chapter walks you through creating bootable media and the installation process.
Chapter 2, Managing Users, covers user management in full. Topics here will include creating and removing users, password policies, the sudo command, as well as group management and switching from one user to another.
Chapter 3, Managing Storage Volumes, takes a look at storage volumes. You'll be shown how to view disk usage, format volumes, manage the /etc/fstab file, use LVM, and more. In addition, we'll look at managing swap and creating links.
Chapter 4, Connecting to Networks, takes a look at networking in Ubuntu, specifically how to connect to resources from other nodes. We'll look at assigning IP addresses, connecting to other nodes via OpenSSH, as well as name resolution.
Chapter 5, Managing Software Packages, takes the reader through the process of searching for, installing, and managing packages. This will include managing APT repositories and installing packages, and even a look at Snap packages.
Chapter 6, Controlling and Monitoring Processes, teaches the reader how to manage what is running on the server, as well as how to stop misbehaving processes. This will include having a look at htop, systemd, managing jobs, and understanding the load average.
Chapter 7, Setting Up Network Services, revisits networking with more advanced concepts. In this chapter, the reader will learn more about the technologies that glue our network together, such as DHCP and DNS. The reader will set up their our own DHCP and DNS server, as well as installing NTP.
Chapter 8, Sharing and Transferring Files, is all about sharing files with others. Concepts will include the set up of Samba and NFS network shares, and we will even go over transferring files manually with rsync and scp.
Chapter 9, Managing Databases, takes the reader through the journey of setting up and managing databases via MariaDB. The reader will learn how to install MariaDB, how to set up databases, and how to create a slave database server.
Chapter 10, Serving Web Content, takes a look at serving content with Apache. In addition, the reader will be shown how to secure Apache with an SSL certificate, manage modules, and set up keepalived. Installing Nextcloud is also covered.
Chapter 11, Learning Advanced Shell Techniques, goes over additional tips, tricks, and techniques to enhance the reader's usage of command lines. Topics here include managing output, setting up aliases, investigating Bash history, and more.
Chapter 12, Virtualization, is all about virtualization (unsurprisingly!) The reader will be walked through setting up their very own KVM installation, as well as how to manage virtual machines with virt-manager.
Chapter 13, Running Containers, discusses the subject of containers and show the reader how to manage containers in both Docker and LXD.
Chapter 14, Automating Server Configuration with Ansible, will show the reader how to set up a Git repository for holding configuration management scripts, how to use the powerful Ansible to automate common administrative tasks, and also how to use ansible-pull.
Chapter 15, Securing Your Server, takes a look at various things the reader can do to strengthen security on Ubuntu servers. Topics will include concepts such as lowering the attack surface, securing OpenSSH, setting up a firewall, and more.
Chapter 16, Troubleshooting Ubuntu Servers, consists of topics relating to things we can do when our deployments don't go exactly according to plan. The reader will also investigate the problem space, view system logs, and trace network issues.
Chapter 17, Preventing and Recovering from Disasters, informs the reader of various strategies that can be used to prevent and recover from disasters. This includes a look at utilizing Git for configuration management, implementing a backup plan, and more.
Appendix, Using the Alternate Installer, shows the reader how to utilize an alternative installer for Ubuntu that can be used to set up more advanced installations, such as Ubuntu on RAID.
To get the most out of this book
This book is for readers who already have some experience with Linux, though it doesn't necessarily have to be with Ubuntu. Preferably, the reader will understand basic Linux command-line skills, such as changing directories, listing contents, and issuing commands as regular users or with root. Even if you don't have these skills, you should read this book anyway—the opening chapters will cover many of these concepts.
In this book, we'll take a look at real-world situations in which we can deploy Ubuntu Server. This will include the installation process, serving web pages, setting up databases, and much more. Specifically, the goal here is to be productive. Each chapter will teach the reader a new and valuable concept, using practical examples that are relative to real organizations. Basically, we focus on getting things done, not primarily on theory. Although the theory that goes into Linux and its many distributions is certainly interesting, the goal here is to get you to the point where if a work colleague or client asks you to perform work on an Ubuntu-based server, you'll be in a good position to get the task done. Therefore, if your goal is to get up and running with Ubuntu Server and learn the concepts that really matter, this book is definitely for you.
To follow along, you'll either need a server on which to install Ubuntu Server, a virtual Ubuntu instance from a cloud provider, or a laptop or desktop capable of running at least one virtual machine.
Conventions used
There are a number of text conventions used throughout this book.
CodeInText
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "I added an IP address of 192.168.0.101
with a CIDR mask of /24
."
A block of code is set as follows:
# This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: enp0s3: dhcp4: yes
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: no
addresses: [192.168.0.101/24]
gateway4: 192.168.1.1
nameservers:
addresses: [192.168.1.1,8.8.8.8]
Any command-line input or output is written as follows:
sudo ip link set enp0s3 down sudo ip link set enp0s3 up
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "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.
"
Note
Warnings or important notes appear like this.
Note
Tips and tricks appear like this.
Get in touch
Feedback from our readers is always welcome.
General feedback: Email [email protected]
and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected]
.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected]
with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Reviews
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packtpub.com.