How to start service on boot with RHEL 8 / CentOS 8 Linux

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.

Using systemclt command to Enable or Disable service to start on Boot with RHEL 8 / CentOS 8.

Using systemclt command to Enable or Disable service to start on Boot with RHEL 8 / CentOS 8.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
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



  1. 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

  2. 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.

  3. If you later on decide to disable any service to start on boot use the systemctl command once again as follows:
    # systemctl disable httpd