Let me demonstrate what you can do to manage services with systemd. For your convenience, I
have listed most of the commands on the slides to help you around a little bit.
Let me start by using sudo systemctl t help systemctl is the
main utility to manage systemd and it comes with great help.
It uses tab completion, but you can also use help in many cases where it
will tell you what is going on. Here we have t, which stands for type,
and that is showing all the different types of units that systemd is managing.
Now let me use systemctl list unit files.
This is showing all the different unit files that are installed on your system in their current state.
You can see that these unit valves are grouped.
We have the mounts, we have the pads, and most important, we have all of
these services that make up for what your server is supposed to be doing.
The unit valves is giving an overview from vals perspective, including files that are
not currently active. You can also use systemctl list units that will only show
active units and that allows you to really investigate what is going on.
And also it shows if anything has failed, like right here and there. You can further investigate if you want.
Now, most important thing with systemd is to make sure that you can start and run services.
In order to do so, I'm going to do a quick installation sudo dnf install y HTTPD
this is installing the HTTPD web service and we are going to use it as dummy service.
So a good way to get started is by using systemctl status on httpd, which is showing
that the HTTPD service is loaded, well loaded. That means that systemd is aware of its configuration
file and the configuration file is right here. User lib SystemD system and httpD service it is
disabled, which means that it won't be started automatically. The preset is disabled, which means that that
is the current state as it comes from the package and it's inactive and dead.
So it's not doing anything.
You want to change that? Well, you use sudo systemctl
this time because we are changing the operating system status.
Enable HTTPD that is going to flag the HTTPD service
for automatic starting, but it doesn't change the current state.
If you do want to change the current state, well, you need to start it manually.
Now if you use status again, you can see everything that it is doing. It's a lot of information
that it's displaying, including the status and where it is listening. The main process ID the amount of memory
that it is using and even information that has been logged for this specific service by systemd Journald.
Now, for whatever reason, you want to remove the service from its active state. You
can use sudo systemctl and let me combine stuff a little bit this time. Disable
now on httpd. That will disable it and that will stop it at the same.
And now we are back and HTTPD is not active anymore.