How to Configure Network Services to Auto Start on Boot

It’s usually a good idea to configure essential network services to automatically start on boot. This saves you the hassle of starting them manually upon a reboot and also, the resulting havoc caused in case you forget to do so. Some of the crucial network services include SSH, NTP, and httpd.

You can confirm what is your system service manager by running the following command.

# ps --pid 1
Check Linux Service Manager
Check Linux Service Manager

Based on the output of the above command, you will use one of the following commands to configure whether each service should start automatically on boot or not:

On systemd-based
----------- Enable Service to Start at Boot -----------
# systemctl enable [service]
----------- Prevent Service from Starting at Boot -----------
# systemctl disable [service] # prevent [service] from starting at boot
On sysvinit-based
----------- Start Service at Boot in Runlevels A and B -----------
# chkconfig --level AB [service] on 
-----------  Don’t Start Service at boot in Runlevels C and D -----------
# chkconfig --level CD service off 

On a systemd system like CentOS 8, RHEL 8 and Fedora 30+, the systemctl command is used for managing services. For example, to have a view of the disabled services, run the command:

$ sudo systemctl list-unit-files --state=disabled
$ sudo chkconfig --list     [On sysvinit-based]

The output below prints out all the disabled services and as you can see, the httpd service is listed, implying that it is not configured to start on boot.

List Disabled Network Services
List Disabled Network Services

To enable a service to start on boot, use the syntax:

$ sudo systemctl enable service-name
$ sudo chkconfig service_name on     [On sysvinit-based] 

For example, to enable httpd service on boot execution.

$ sudo systemctl enable httpd
$ sudo chkconfig httpd on     [On sysvinit-based] 

To confirm that the httpd service has been enabled, list all the enabled services by executing the command:

$ sudo systemctl list-unit-files --state=enabled
$ sudo chkconfig --list | grep 3:on     [On sysvinit-based] 
List Enabled Network Services
List Enabled Network Services

From the output above, we can clearly see that the httpd service now appears in the list of enabled services.

To learn more about systemctl and chkconfig commands, read these following articles:

Two small things before you go

If something didn’t work on your setup, leave a comment and tell me which distro and version you’re on. I read every one, and most of these articles got better because a reader pointed out what was missing.

And if it did work, share it. TecMint has stayed free for 14 years because people pass these articles around, and that traffic is what pays for writing the next one.

Leave a comment
Get two free Linux courses

Learn the Linux basics with two free courses and join 34,000+ readers getting practical TecMint tutorials and selected Pro TecMint articles every week.

Pro TecMint
Get lifetime access for $99

If you want to go beyond the free tutorials, Pro gives you 18 courses, 5 ebooks, and every future course I add. One payment, lifetime access, no renewals.

Ravi Saive
Ravi Saive
Administrator
About the author

I'm Ravi Saive, an award-winning entrepreneur and founder of several successful 5-figure online businesses, including TecMint.com, GeeksMint.com, UbuntuMint.com, and the premium learning hub Pro.Tecmint.com.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.