CIS126RH | RHEL System Administration 1 Mesa Community College
Learning Objectives
1
Control services with systemctl
Start, stop, restart, and check status of system services
2
Understand systemd units
Work with service, target, socket, and other unit types
3
Manage boot targets
Configure default boot target and switch between targets
4
View service logs
Use journalctl to examine systemd journal entries
What is systemd?
systemd is the system and service manager for Linux. It's the first process started by the kernel (PID 1) and is responsible for bringing up the rest of the system.
Service Manager
Starts, stops, and monitors system services and daemons
Dependency Handling
Manages service dependencies and ordering automatically
Parallel Startup
Starts services in parallel for faster boot times
Logging (Journal)
Captures and stores logs from services and the kernel
PID 1: systemd is always PID 1. If it crashes, the kernel panics. It's the ancestor of all other processes.
systemd Units
A unit is a resource that systemd knows how to manage. Units are defined by unit files and identified by their name and type suffix.
.service
System services (daemons)
.target
Group of units (like runlevels)
.socket
Socket activation (on-demand start)
.mount
Filesystem mount points
.timer
Scheduled tasks (like cron)
.path
Path monitoring (file triggers)
# List all unit types[student@server ~]$ systemctl -t help
Available unit types:
service socket target device mount automount swap
snapshot timer path slice scope
Unit File Locations
Directory
Purpose
Priority
/usr/lib/systemd/system/
Installed by packages (RPM)
Lowest
/etc/systemd/system/
Local administrator customizations
Highest
/run/systemd/system/
Runtime units (temporary)
Medium
# View where a unit file is located[student@server ~]$ systemctl cat sshd.service
# /usr/lib/systemd/system/sshd.service
[Unit]
Description=OpenSSH server daemon
...# List all unit files and their states[student@server ~]$ systemctl list-unit-files
UNIT FILE STATE VENDOR PRESET
sshd.service enabled enabled
httpd.service disabled disabled
...# Show the actual file path[student@server ~]$ systemctl show -p FragmentPath sshd.service
FragmentPath=/usr/lib/systemd/system/sshd.service
The systemctl Command
# Basic syntax
systemctl [command] [unit]
# Common service control commands[root@server ~]# systemctl start httpd.service # Start now[root@server ~]# systemctl stop httpd.service # Stop now[root@server ~]# systemctl restart httpd.service # Stop then start[root@server ~]# systemctl reload httpd.service # Reload config# Check status[student@server ~]$ systemctl status httpd.service
[student@server ~]$ systemctl is-active httpd.service
[student@server ~]$ systemctl is-enabled httpd.service
# Boot-time configuration[root@server ~]# systemctl enable httpd.service # Start at boot[root@server ~]# systemctl disable httpd.service # Don't start at boot# Combined: enable and start in one command[root@server ~]# systemctl enable --now httpd.service
Tip: The .service suffix is optional for service units. systemctl start httpd works the same as systemctl start httpd.service.
Service Status Deep Dive
●sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: enabled)
Active:active (running) since Mon 2025-12-08 09:00:00 EST; 2h ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 1234 (sshd)
Tasks: 1 (limit: 23456)
Memory: 5.2M
CPU: 125ms
CGroup: /system.slice/sshd.service
└─1234 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
Dec 08 09:00:00 server systemd[1]: Starting OpenSSH server daemon...
Dec 08 09:00:00 server sshd[1234]: Server listening on 0.0.0.0 port 22.
Dec 08 09:00:00 server systemd[1]: Started OpenSSH server daemon.