Centos: remove service from running at server startup

So, you have a service running on server startup that you need to stop running.  Here is how I stop a service from running on startup on Centos (Red Hat) using chkconfig.

From the command line run

chkconfig –list

to show all the services, including their run level.  You can list the run levels for a particular service, in this case, mysqld, by doing this:

chkconfig –list mysqld

You should get something that looks like this:

mysqld  0:off   1:0ff   2:on   3:on   4:on   5:on   6:off

Now you can use chkconfig to turn off (or on) the services for the specific run levels.  Here we will turn off the mysqld (not that I recommend doing that on your webserver):

I recommend making a note of what they were before you change them.  Just in case.

chkconfig –level 2345 mysqld off

to turn it back on again

chkconfig –level 2345 mysqld on


“Hey, what are those run-level things all about?” you might ask.  Here is a quick overview of the Centos runlevels.

  1. single user mode (no network, just root user)
  2. multi-user mode (no network)
  3. multi-user mode with networking  (most common – you’ll need a network for your webserver, eh )
  4. undefined (user-definable boot state)
  5. X11 (X windows System – if used as workstation or desktop – most webservers won’t be doing this)
  6. reboot  (probably will never want this)

oh and “0” is the halt runlevel (when the system shuts down, you won’t want this either)

Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Apply your human brain cells and complete this highly complicated maths problem *