How do I set a service to start up automatically? CentOS

To auto start services in Centos or Redhat OS, you can use builtin chkconfig utility. It is located in /sbin directory. If you are a regular user (non-root), then /sbin may not be in your path. Therefore, you may have to use the full path to access the chkconfig utility.

To auto start a new service:

  • Find out the name of service’s script from /etc/init.d/ directory e.g. mysqld or httpd
  • Add it to chkconfig
    sudo /sbin/chkconfig --add mysqld
  • Make sure it is in the chkconfig.
    sudo /sbin/chkconfig --list mysqld
  • Set it to autostart
    sudo /sbin/chkconfig mysqld on

To stop a service from auto starting on boot

  • sudo /sbin/chkconfig mysqld off



chkconfig httpd on


This will enable apache22 to start at boot.

To get more deeply into it, you can look at /etc/rc.d/rc.3. You’ll see a bunch of symbolic links beginning with either k or s. Those with s are started at boot in runlevel 3.

So I get that S links are started in run level 3, but what significance do the numbers have?
I assume it has something to do with the order they start up?
For example.