In this video, you'll learn how to manage systemd services.
So after installation of RHEL, many units are enabled
and will be started automatically.
You can use systemctl status on any of them
to view the current status of a unit,
like systemctl status sshd.
Now in the output, you will see the active line,
which shows the current status, and the loaded line,
which is showing which configuration
file currently is used, and whether the unit is
enabled for automatic starting.
Common management tasks include systemctl status,
which is giving current status information,
or systemctl start, which will start it in case
it's not currently active.
And systemctl stop, well, you probably have guessed,
that's doing the opposite.
If you want a unit to be started automatically
when your system boots, you need systemctl enable,
and add minus minus now to it if you want to start it now,
in case it hasn't been done yet.
And the opposite is systemctl disable.
Systemctl restart, restarts the unit,
and that is useful to have a service pickup change
configuration.
Let me show you some of these common management tasks.
So I'm going to run dnf install minus y vsftpd,
because I want something that isn't running yet,
and vsftpd happens to be one of these things.
So let me use systemctl status and vs tab.
And as you can see, that is working.
It's completing to vsftp dot.
Well, double tab completion, and then we
can see that there's a vsftpd dot service and a target.
I would like to check on the service.
And there we can see that, oh, there's a white dot.
That means that it's not currently active.
The loaded line is giving userlib systemd system
vsftpd dot service.
So that's information about the unit file that is behind it,
but it's disabled.
And the preset, that means the default state
as it comes from the package, is disabled as well,
and currently it's inactive.
Good, let me change that by using systemctl enable
minus minus now on vsftpd.
And then when I use status again,
we can see that it is enabled.
It is active, and it is running.
And we see some more information as well.
So the main process and process ID is right here.
And currently there's one task, and you
can see information about memory usage, about CPU usage.
It's even showing log information about the unit.
And that's pretty cool.
Now, if you don't want the unit anymore, of course,
you can do the opposite, systemctl stop
if you want to stop it, or systemctl disable minus minus
now on vsftpd to stop it, and also to stop starting it
automatically upon system boot.