How to set service to start on boot in Linux?

Some important software you have installed in Linux server does not start up and cause the website error. So you have to manually start them all 1 by 1 and it is kind of troublesome to do it whenever you bootup the server.

Hence, I would like to share on how you can make the service to automatically start up after reboot. To have services automatically start at boot time you can use the built-in chkconfig utility. Chkconfig command is used to setup, view, or change services that are configured to start automatically during the system startup or bootup.

How to set service start on boot?

1. Find out the services name that you would like to make auto start up for example mysqld or httpd
2. Add it to chkconfig using the below command (We use xinetd as an example) if the services still not in the services list.
chkconfig –add xinetd
Remark: If the services still not in the services list.
3. Set it to autostart at boot time
chkconfig xinetd on
4. To verify on it, kindly using below command
chkconfig –list xinetd
The output should be as below
xinetd 0:off   1:off   2:on    3:on    4:on    5:on    6:off

Thats it. Your service will now start at boot time when your server is restarted.

To stop a service from starting at boot time:
chkconfig xinetd off



Comments