How do I use the 'chkconfig' utility to add or remove services from starting up automatically on my RedHat linux server?

Chkconfig is a RedHat specific utility that allows you to view which or add/remove services from starting up automatically on a RedHat linux server.


To view the current startup status of a specific service, use the following commands:


   chkconfig —list | grep <servicename>


   example:  chkconfig —list | grep httpd


which should return something like this:


   httpd           0:off   1:off   2:off   3:on    4:off   5:on    6:off 
 


Each number indicates a system run-level following by the startup status(on or off).  The default linux run-level is 3(run-level 5 if you boot a graphical interface, however unlikely), but you usually want to make runlevels 2,3,4 and 5 the same status to be safe.  To enable or disable a service for run-levels 2,3,4 and 5, use the command below:



   chkconfig  —level 2345 <servicename> <status> 


   example:  chkconfig —level 2345 httpd on



After all the above, you should see the service listed in chkconfig, and it should start on boot.

Your rating: None