On Linux dedicated servers, you can configure services or daemons to start at boot. This means that the programs will start running as soon as your server starts and, ideally, continue to do so as long as the server remains operational. We will look at three distinct ways to configure boot-time services: from the command line, from within CentOS’ “setup” program, and from within Webmin’s web-based control panel. All three of these methods should work in CentOS, Red Hat Enterprise Linux, and Fedora.
From the command line, you can configure any service to start at boot with the command “chckconfig”. For example, if you want Apache to start at boot, you would type:
# chkconfig httpd on
This will enable Apache on runlevels 2,3,4, and 5.
To make sure that it is now scheduled to start at boot, type this command:
# chkconfig --list httpd
The output should look like this:
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
To start a service at boot only on certain run levels, type the command with the “level” option:
# chkconfig --level 345 sshd on
In that example, sshd would be configure to start on run levels 3,4,5.
Once you have your service scheduled to boot, it will still not be turned on in the current session. Therefore, you will still need to start it.
# service httpd start
For more information about chkconfig, see the online documentation. In part 2, we will look at starting and stopping services with graphical interfaces in Setup and in Webmin.
- 3 Ways to Configure Services to Start at Boot in CentOS: Part 2
- How to Autostart Services In Red Hat, CentOS, and Fedora
- How to Control Linux Services
- Starting, Stopping, and Reloading Services
- How to Disable Unused Services on a Server