Helion


Szczegóły ebooka

Linux Service Management Made Easy with systemd

Linux Service Management Made Easy with systemd


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.

  • Linux Service Management Made Easy with systemd
  • Contributors
  • About the author
  • About the reviewer
  • Preface
    • Who this book is for
    • What this book covers
    • To get the most out of this book
    • Download the example code files
    • Code in Action
    • Download the color images
    • Conventions used
    • Get in touch
    • Share Your Thoughts
  • Section 1: Using systemd
  • Chapter 1: Understanding the Need for systemd
    • Technical requirements
    • The history of Linux init systems
    • The shortcomings of SysV Init and upstart
    • The advantages of systemd
      • systemds simplicity
      • systemd's consistency
      • systemd's performance
      • systemd security
    • The systemd controversy
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 2: Understanding systemd Directories and Files
    • Technical requirements
    • Understanding the systemd configuration files
    • Understanding the systemd unit files
      • Types of unit files
    • Understanding the systemd executables
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 3: Understanding Service, Path, and Socket Units
    • Technical requirements
    • Understanding service units
      • Understanding the Apache service file
      • Understanding the Secure Shell service file
      • Understanding the timesyncd service file
    • Understanding socket units
    • Understanding path units
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 4: Controlling systemd Services
    • Technical requirements
    • Verifying the status of a service
    • Starting, stopping, and reloading services
    • Enabling and disabling services
    • Killing a service
    • Masking a service
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 5: Creating and Editing Services
    • Technical requirements
    • Editing an existing service
      • Creating a partial edit to the [Install] section
      • Creating a partial edit to the [Service] section
      • Creating a full edit
    • Creating a new service
    • Changing the default systemd editor
    • Creating a new container service with podman
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 6: Understanding systemd Targets
    • Technical requirements
    • Understanding the purpose of systemd targets
    • Understanding the structure of a target file
      • Understanding the sockets.target file
      • Understanding dependencies in the sshd.service file
    • Comparing systemd targets to SysVinit runlevels
    • Understanding target dependencies
    • Changing the default target
    • Temporarily changing the target
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 7: Understanding systemd Timers
    • Technical requirements
    • Comparing systemd timers with cron
      • Viewing timer information
    • Understanding timer options
      • Understanding monotonic timers
      • Understanding real-time timers
      • Understanding calendar events for real-time timers
    • Creating timers
      • Creating a system-level timer
      • Creating a user-level timer
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 8: Understanding the systemd Boot Process
    • Technical requirements
    • Comparing SysV bootup and systemd bootup
      • Understanding SysV and systemd bootup similarities
      • Understanding the SysV bootup process
      • Understanding the systemd bootup process
    • Analyzing bootup performance
    • Some differences on Ubuntu Server 20.04
    • Understanding systemd generators
      • Understanding mount units
      • Understanding backward compatibility
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 9: Setting System Parameters
    • Technical requirements
    • Setting the locale parameter
      • Understanding the locale
      • Changing the default locale on the Alma machine
      • Changing the default locale on Ubuntu
    • Setting time and timezone parameters
    • Setting the hostname and machine information
      • Viewing the information
      • Setting the information
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 10: Understanding Shutdown and Reboot Commands
    • Technical requirements
    • Shutting down with systemctl
    • Halting with systemctl
    • Rebooting with systemctl
    • Using shutdown instead of systemctl
    • Running a job before shutting down
    • Summary
    • Questions
    • Answers
    • Further reading
  • Section 2: Understanding cgroups
  • Chapter 11: Understanding cgroups Version 1
    • Technical requirements
    • Understanding the history of cgroups
    • Understanding the purpose of cgroups
    • Understanding the structure of cgroups Version 1
    • Understanding the cgroup filesystem
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 12: Controlling Resource Usage with cgroups Version 1
    • Technical requirements
    • Understanding resource controllers
      • Examining the resource controllers
      • Preparing for the demos
    • Controlling CPU usage
      • Controlling Vicky's CPU usage
      • Controlling CPU usage for a service
    • Controlling memory usage
    • Controlling blkio usage
      • Setting a blkio limit for Vicky
      • Setting a blkio limit for a service
    • Understanding pam_limits and ulimit
      • The ulimit command
      • The pam_limits module
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 13: Understanding cgroup Version 2
    • Technical requirements
    • Understanding the need for Version 2
      • Version 1 complexity
      • Version 1 attribute filenames
      • No support for rootless containers
    • Understanding the improvements in cgroup Version 2
    • Setting resource limits on rootless containers
    • Understanding cpuset
    • Converting RHEL 8-type distros to cgroup version 2
    • Summary
    • Questions
    • Answers
    • Further reading
  • Section 3: Logging, Timekeeping, Networking, and Booting
  • Chapter 14: Using journald
    • Technical requirements
    • Understanding the pros and cons of rsyslog
    • Understanding the pros and cons of journald
    • Understanding journald on Ubuntu
    • Understanding journald on RHEL-type systems
    • Using journalctl
      • Searching for and viewing log data with journalctl
    • Sealing journald log files for security
    • Setting up remote logging with journald
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 15: Using systemd-networkd and systemd-resolved
    • Technical requirements
    • Understanding networkd and resolved
    • Understanding Netplan on Ubuntu
      • Viewing installer-generated Netplan configurations
      • Creating Netplan configurations
    • Understanding networkd and resolved on RHEL-type machines
    • Using networkctl and resolvectl
    • Viewing the networkd and resolved unit files
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 16: Understanding Timekeeping with systemd
    • Technical requirements
    • Understanding the importance of accurate time
    • Comparing NTP implementations
    • Understanding chrony on the AlmaLinux machine
      • The chronyd.service file
      • The chrony.conf file
      • Setting up a chronyd time server
      • Using chronyc
    • Understanding systemd-timesyncd
      • The systemd-timesyncd.service file
      • The timesyncd.conf file
      • Using timedatectl
      • Configuring Ubuntu to use chrony
    • Understanding the Precision Time Protocol
      • An overview of PTP
      • Installing PTP
      • Configuring PTP with software timestamping on AlmaLinux
      • Configuring PTP with hardware timestamping on AlmaLinux
      • Configuring PTP with software timestamping on Ubuntu
      • Configuring PTP with hardware timestamping on Ubuntu
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 17: Understanding systemd and Bootloaders
    • Technical requirements
    • Understanding the basic computer architecture
    • Understanding GRUB2
      • Comparing GRUB2 on BIOS and EFI/UEFI systems
      • GRUB2 on BIOS-based and EFI/UEFI-based Ubuntu machines
    • Understanding systemd-boot
    • Understanding Secure Boot
    • Summary
    • Questions
    • Answers
    • Further reading
  • Chapter 18: Understanding systemd-logind
    • Technical requirements
    • Understanding the need for a new login service
    • Understanding systemd-logind.service
      • The Alma Linux systemd-logind.service file
      • The Ubuntu Server systemd-logind.service file
    • Understanding logind.conf
      • Virtual terminals
      • Keeping user processes going after logout
      • Power management directives
      • The IdleAction directives
    • Understanding loginctl
    • Understanding polkit
    • Summary
    • Questions
    • Answers
    • Further reading
    • Why subscribe?
  • Other Books You May Enjoy
    • Packt is searching for authors like you
    • Share Your Thoughts