Enabling and disabling services
It's all well and good that we have Apache running, but if we were to reboot our Alma Linux machine, Apache won't start until you start it manually. To begin this demo, first stop Apache with this:
sudo systemctl stop httpd
Now, enable it by doing this:
[donnie@localhost ~]$ sudo systemctl enable httpd Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service. [donnie@localhost ~]$
When we enable the Apache service, we create a symbolic link in the /etc/systemd/system/multi-user.target.wants/
directory that points back to the httpd.service
file. Now, I've been telling you all along that the unit files are in the /lib/systemd/system/
directory. But the eagle-eyed among you will notice that the symbolic link points to the service file in the /usr/lib/systemd/system/
directory. That's because the newer versions of many Linux distros have gotten rid of certain...