Your one-stop resource to learn, configure and use Ubuntu 22.04 for your day-to-day operations and deployments
Key Features
• Get well-versed with newly added features in Ubuntu 22.04
• Master the art of installing, managing, and troubleshooting Ubuntu Server
• Leverage the improved performance and security-related aspects of Ubuntu Server 22.04
Book Description
Ubuntu Server is taking the server world by storm - and for a good reason! The server-focused spin of Ubuntu is a stable, flexible, and powerful enterprise-class distribution of Linux with a focus on running servers both small and large.
Mastering Ubuntu Server is a book that will teach you everything you need to know in order to manage real Ubuntu-based servers in actual production deployments. This book will take you from initial installation to deploying production-ready solutions to empower your small office network, or even a full data center. You'll see examples of running an Ubuntu Server in the cloud, be walked through set up popular applications (such as Nextcloud), host your own websites, and deploy network resources such as DHCP, DNS, and others. You'll also see how to containerize applications via LXD to maximize efficiency and learn how to build Kubernetes clusters. This new fourth edition updates the popular book to cover Ubuntu 22.04 LTS, which takes advantage of the latest in Linux-based technologies.
By the end of this Ubuntu book, you will have gained all the knowledge you need in order to work on real-life Ubuntu Server deployments and become an expert Ubuntu Server administrator who is well versed in its feature set.
What you will learn
• Install Ubuntu Server on physical servers and on the Raspberry Pi
• Deploy Ubuntu Server in the cloud and host websites on your own server
• Deploy your applications to their own containers and scale your infrastructure
• Set up popular applications such as Nextcloud
• Automate deployments and configuration with Ansible to save time
• Containerize applications via LXD to maximize efficiency
• Discover best practices and troubleshooting techniques
Who this book is for
This book is for System Administrators, Site Reliability Engineers, DevOps professionals, enthusiasts, as well as for individuals looking to make a career change and learn the skills they'll need to work with Ubuntu servers. Prior knowledge of Ubuntu is not required but a basic understanding of basic computing concepts is assumed. Some IT administration, Linux, and shell scripting experience is preferred, although the first several chapters will bring newcomers up to speed as well.
Author(s): Jay LaCroix
Edition: 4
Publisher: Packt Publishing
Year: 2022
Language: English
Commentary: Vector PDF
Pages: 582
City: Birmingham, UK
Tags: Linux; Amazon Web Services; Cloud Computing; Command Line; Unix; Security; Monitoring; System Administration; Docker; MariaDB; Troubleshooting; Networking; Kubernetes; SSH; Web Servers; Ansible; Storage Management; Container Orchestration; Terraform; Process Management; Ubuntu; User Management; ngnix; Disaster Recovery; Package Management
Cover
CopyRight Page
Contributors
Table of Contents
Preface
Chapter 1: Deploying Ubuntu Server
Technical requirements
Determining your server’s role
Choosing a device for our server
Physical server
Physical desktop
Laptop
Virtual machine
Virtual private server
Raspberry Pi
Obtaining installation media
Creating a bootable flash drive
Planning the partitioning layout
Installing Ubuntu Server
Installing Ubuntu on a Raspberry Pi
Summary
Relevant tutorials
Chapter 2: Managing Users and Permissions
Understanding the purpose of users and groups
Understanding when to use root
Using sudo to run privileged commands
Creating and removing users
Using useradd
Using adduser
Removing users
Understanding the /etc/passwd and /etc/shadow files
Understanding the /etc/passwd file
Understanding the /etc/shadow file
Distributing default configuration files with /etc/skel
Switching users
Managing groups
Managing passwords and password policies
Locking and unlocking user accounts
Setting password expiration information
Setting a password policy
Configuring administrator access with sudo
Setting permissions on files and directories
Viewing permissions
Changing permissions
Changing the ownership of objects
Summary
Relevant videos
Further reading
Chapter 3: Managing Software Packages
Understanding Linux package management
Understanding the differences between Debian and Snap packages
Debian packages
Snap packages
Installing and removing software
Managing Debian packages with apt
Managing Snap packages with snap
Searching for packages
Managing package repositories
Adding additional repositories
Adding Personal Package Archives
Backing up and restoring Debian packages
Cleaning up orphaned apt packages
Taking advantage of hardware enablement updates
Summary
Relevant video
Further reading
Chapter 4: Navigating and Essential Commands
Learning essential Linux commands
Understanding the Linux filesystem layout
Viewing the contents of files
Viewing application log files
Summary
Relevant video
Further reading
Chapter 5: Managing Files and Directories
Copying, moving, and renaming files and directories
Editing files with the Nano and Vim text editors
Editing with Nano
Editing with Vim
Input and output streams
Using symbolic and hard links
Summary
Relevant videos
Chapter 6: Boosting Your Command-line Efficiency
Understanding the Linux shell
Understanding Bash history
Learning some useful command-line tricks
Understanding variables
Writing simple scripts
Putting it all together – Writing an rsync backup script
Summary
Relevant videos
Further reading
Chapter 7: Controlling and Managing Processes
Managing jobs
Understanding the ps command
Viewing running processes with ps
Configuring arguments to ps
Changing the priority of processes
Dealing with misbehaving processes
Managing system processes
Scheduling tasks with cron
Summary
Relevant videos
Further reading
Chapter 8: Monitoring System Resources
Viewing disk usage
Using df
Diving deeper into disk usage
Monitoring memory usage
Understanding server memory
Managing swap
Understanding load average
Viewing resource usage with htop
Summary
Relevant videos
Further reading
Chapter 9: Managing Storage Volumes
Adding additional storage volumes
Formatting and partitioning storage devices
Creating a partition
Formatting partitions
Mounting and unmounting volumes
Understanding the /etc/fstab file
Analyzing the contents of /etc/fstab
Adding to the /etc/fstab file
Backing up and restoring volumes
Utilizing LVM
Getting started with LVM
Formatting logical volumes
Removing volumes with LVM
Understanding LVM snapshots
Summary
Relevant videos
Further reading
Chapter 10: Connecting to Networks
Setting the hostname
Managing network interfaces
Assigning static IP addresses
Understanding Linux name resolution
Getting started with OpenSSH
Installing OpenSSH
Issuing commands with OpenSSH
Getting started with SSH key management
Generating public and private keys
Copying your public key to a remote server
Utilizing an SSH agent
Changing the passphrase of an OpenSSH key
Simplifying SSH connections with a config file
Summary
Relevant videos
Further reading
Chapter 11: Setting Up Network Services
Planning your IP address scheme
Setting up a DHCP server for serving IP addresses
Adding a DNS server
Setting up external DNS with bind
Setting up internal DNS and adding hosts
Setting up an internet gateway
Summary
Further reading
Chapter 12: Sharing and Transferring Files
File server considerations
Sharing files with Windows users via Samba
Setting up NFS shares
Transferring files with rsync
Transferring files with SCP
Summary
Relevant videos
Further reading
Chapter 13: Managing Databases
Preparations for setting up a database server
Installing MariaDB
Understanding the MariaDB configuration files
Managing MariaDB databases
Setting up a secondary database server
Summary
Further reading
Chapter 14: Serving Web Content
Installing and configuring Apache
Installing additional Apache modules
Securing Apache with TLS
Installing and configuring NGINX
Setting up and configuring Nextcloud
Summary
Relevant videos
Further reading
Chapter 15: Automating Server Configuration with Ansible
Understanding the need for configuration management
Why Ansible?
Creating a Git repository
Getting started with Ansible
Making your servers do your bidding
Setting up an inventory file and configuring Ansible settings
Configuring client servers
Putting it all together – automating web server deployment
Using Ansible’s pull method
Summary
Relevant videos
Further reading
Chapter 16: Virtualization
Prerequisites and considerations
Setting up a virtual machine server
Creating virtual machines
Bridging the virtual machine network
Simplifying virtual machine creation with cloning
Managing virtual machines via the command line
Summary
Relevant video
Further reading
Chapter 17: Running Containers
What is containerization?
Understanding the differences between Docker and LXD
Installing Docker
Managing Docker containers
Automating Docker image creation with Dockerfiles
Managing LXD containers
Summary
Relevant videos
Further reading
Chapter 18: Container Orchestration
Container orchestration
Preparing a lab environment for Kubernetes testing
Utilizing MicroK8s
Installing MicroK8s on Linux
Installing MicroK8s on macOS
Installing MicroK8s on Windows
Interacting with MicroK8s
Setting up a Kubernetes cluster
Preliminary setup
Installing Kubernetes
Deploying containers via Kubernetes
Summary
Relevant videos
Further reading
Chapter 19: Deploying Ubuntu in the Cloud
Understanding the difference between on-premises and cloud infrastructure
Important considerations when considering cloud computing as a potential solution
Becoming familiar with some basic AWS concepts
Creating an AWS account
Signing up for AWS
Implementing basic user security
Choosing a region
Deploying Ubuntu as an AWS EC2 instance
Setting up an IAM role for Session Manager
Creating an Ubuntu Server instance in AWS
Creating and deploying Ubuntu AMIs
Automatically scaling Ubuntu EC2 deployments with Auto Scaling
Creating a launch template
Creating an Auto Scaling group
Keeping costs down: understanding how to save money and make cost-effective decisions
Viewing billing information
Adding a billing alert
Removing unneeded backups
Running EC2 instances only when they’re needed
Stopping or terminating unneeded EC2 instances
Taking the cloud further: additional resources to grow your knowledge
Online training and labs
Certification
Keep experimenting and learning
AWS documentation
Summary
Further reading
Chapter 20: Automating Cloud Deployments with Terraform
Why it’s important to automate your infrastructure
Introduction to Terraform and how it can fit within your workflow
Installing Terraform
Automating an EC2 instance deployment
Managing security groups with Terraform
Using Terraform to destroy unused resources
Combining Ansible with Terraform for a full deployment solution
Summary
Chapter 21: Securing Your Server
Lowering your attack surface
Understanding and responding to CVEs
Installing security updates
Automatically installing patches with the Canonical Livepatch service
Securing OpenSSH
Installing and configuring Fail2ban
MariaDB best practices for secure database servers
Setting up a firewall
Encrypting and decrypting disks with LUKS
Locking down sudo
Summary
Further reading
Chapter 22: Troubleshooting Ubuntu Servers
Evaluating the scope
Conducting a root cause analysis
Viewing system logs
Tracing network issues
Troubleshooting resource issues
Diagnosing defective RAM
Summary
Further reading
Chapter 23: Preventing Disasters
Preventing disasters
Utilizing Git for configuration management
Implementing a backup plan
Utilizing bootable recovery media
Summary
Further reading
Other Books You May Enjoy
Index