Book Image

Linux Service Management Made Easy with systemd

4 (1)
Book Image

Linux Service Management Made Easy with systemd

4 (1)

Overview of this book

Linux Service Management Made Easy with systemd will provide you with an in-depth understanding of systemd, so that you can set up your servers securely and efficiently.This is a comprehensive guide for Linux administrators that will help you get the best of systemd, starting with an explanation of the fundamentals of systemd management.You’ll also learn how to edit and create your own systemd units, which will be particularly helpful if you need to create custom services or timers and add features or security to an existing service. Next, you'll find out how to analyze and fix boot-up challenges and set system parameters. An overview of cgroups that'll help you control system resource usage for both processes and users will also be covered, alongside a practical demonstration on how cgroups are structured, spotting the differences between cgroups Version 1 and 2, and how to set resource limits on both. Finally, you'll learn about the systemd way of performing time-keeping, networking, logging, and login management. You'll discover how to configure servers accurately and gather system information to analyze system security and performance. By the end of this Linux book, you’ll be able to efficiently manage all aspects of a server running the systemd init system.
Table of Contents (23 chapters)
1
Section 1: Using systemd
12
Section 2: Understanding cgroups
16
Section 3: Logging, Timekeeping, Networking, and Booting

What this book covers

Chapter 1, Understanding the Need for systemd, explores the history of Linux init systems and explains why the legacy init systems needed to be replaced with something a bit more robust. We'll also briefly look at the controversy that has surrounded the shift to systemd.

Chapter 2, Understanding systemd Directories and Files, explores the various directories that contain systemd files. We'll also explore the various systemd unit files and configuration files, and will explain the purpose of each type. Finally, we'll briefly look at the executable files that are associated with systemd.

Chapter 3, Understanding Service, Path, and Socket Units, examines the inner workings of the service, path, and socket unit files. We'll examine the parts that are in each, and look at some of the parameters that you can set. Along the way, I'll give you some pointers about how to find information about what the various parameters are doing for you.

Chapter 4, Controlling systemd Services, explores how to control systemd services. We'll start by looking at how to list what services are on the system and what their states are. We'll then look at how to enable, disable, start, stop, and restart services.

Chapter 5, Creating and Editing Services, looks at how to use systemctl to create and edit systemd service files. For those of you who need to work with Docker containers, I'll show you a cool method for using the new podman Docker replacement to easily turn your containers into services. We'll also look at how to reload a service file once it's been either added or changed.

Chapter 6, Understanding systemd Targets, looks at the various systemd targets. We'll explain what they are and the structure of a target file. We'll then compare systemd targets to the old SysVinit runlevels, and then look at how to change a system from one target to another.

Chapter 7, Understanding systemd Timers, looks at how to create systemd timers. We'll also compare systemd timers to the old cron system, to see which we like better.

Chapter 8, Understanding the systemd Boot Process, looks at the systemd boot process and how it compares to the old SysVinit boot process.

Chapter 9, Setting System Parameters, looks at how to use systemd utilities to set certain system parameters. Once you see how it's done with systemd, you just might agree that systemd makes it easier.

Chapter 10, Understanding Shutdown and Reboot Commands, looks at how to use the systemctl utility to shut down and reboot a Linux system. After that, we'll see whether the old-fashioned shutdown command still works.

Chapter 11, Understanding cgroups Version 1, looks at what cgroups are and a bit about their history. We'll then look at how cgroups can help make a Linux system more secure.

Chapter 12, Controlling Resource Usage with cgroups Version 1, looks at using cgroups to control resource usage on a modern Linux system. This includes how to control memory and CPU usage, as well as how to allocate resources to users.

Chapter 13, Understanding cgroups Version 2, looks at cgroups version 2. We'll see how it's different from version 1 and how it improves upon version 1. After that, we'll take a brief look at how to work with it. As an added bonus, we'll look at how we can easily do things with cgroup version 2 that we can't easily do with version 1, such as creating cpusets and assigning CPU cores to the proper non-uniform memory access (NUMA) node.

Chapter 14, Using journald, looks at the basic usage of journald and how it differs from the legacy rsyslog. We'll also look at why we still need rsyslog. Most importantly, you'll learn how to extract and format the data you need from your system logs.

Chapter 15, Using systemd-networkd and systemd-resolved, shows you why you might want to use systemd-networkd and systemd-resolved instead of the default Network Manager, and how to go about doing so. We'll give you an in-depth look at how to set up systemd-networkd for various scenarios and how the procedure differs for the Ubuntu- and Red Hat-type distros.

Chapter 16, Understanding Timekeeping with systemd, looks at the various ways to maintain accurate time on systemd systems. We'll look at ntp, chrony, systemd-timesyncd, and the Precision Time Protocol. We'll discuss the pros and cons of each and how configure them.

Chapter 17, Understanding systemd and Bootloaders, looks at using both GRUB2 and systemd-boot to set up a machine to use EFI/UEFI mode for booting. We'll then look at installing Pop!_OS Linux on a machine that's set up to use UEFI boot mode, and will briefly discuss the Secure Boot feature.

Chapter 18, Understanding systemd-logind, looks at how to use and configure systemd-logind. We'll also learn how to use the loginctl utility to view information about user login sessions, to control the logind service, and to terminate sessions of troublesome users. We'll wrap up the chapter by taking a brief look at polkit, which is an alternate way of granting administrative privileges to certain users.