Saturday, July 25, 2026

4. Managing Services Like a Pro with Systemd

 Briefing: systemd is the beating heart of modern CentOS. It manages everything from starting your database on boot to keeping your network running. Mastering it is non-negotiable for new system administrators.

Detailed Explanation: When a web server fails to start, knowing how to interact with systemd is the difference between a five-minute fix and a two-hour headache. The primary tool you will use is systemctl.

The Core Workflow:

  • sudo systemctl start [service] – Starts a service immediately.

  • sudo systemctl enable [service] – Tells the service to start automatically every time the server boots.

  • sudo systemctl status [service] – The most important command. It tells you if the service is running, if it crashed, and displays the most recent log entries.

Viewing Logs with Journalctl: systemd handles logging natively. If systemctl status doesn't give you enough information about a crash, type sudo journalctl -u [service]. This isolates the logs for that specific service, allowing you to easily read through its history and identify exactly what went wrong.

No comments:

Post a Comment