On Systemd Linux systems such as RHEL 8 / CentOS 8 it is possible to enable and disable services to start on boot with a single systemctl
command.
In this tutorial you will learn:
- How to enable service to start on boot.
- How to list all services on systemd Linux system.
Software Requirements and Conventions Used
Category | Requirements, Conventions or Software Version Used |
---|---|
System | Red Hat Enterprise Linux 8, CentOS 8 |
Software | N/A |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
How to start service on boot with RHEL 8 / CentOS 8 Linux step by step instructions
- Obtain the service name you wish to enable to start on boot.
There are many ways on how to accomplish this task. Perhaps the simplest solution is to list all currently disabled services using the
systemctl
command:# systemctl list-unit-files --state=disabled
The above command will create a long list of disabled services. Scroll through the list to find the service you wish to enable and take a note of the service name. For example
httpd.service
- Use the
systemctl
command to enable the service in order to start after system boot. Note the suffix.service
can be omitted:# systemctl enable httpd
In the above example we heave enabled the Apache
httpd
service to start during the system boot. - If you later on decide to disable any service to start on boot use the
systemctl
command once again as follows:# systemctl disable httpd