Stop program running at startup in Linux

Depending on your distro use the chkconfig or update-rc.d tool to enable/disable system services.

On a redhat/suse/mandrake style system:

sudo chkconfig apache2 off 

On Debian:

sudo update-rc.d -f apache2 remove

Checkout their man pages for more info.


If you are dealing with a modern Ubuntu system and a few other distros you may have to deal with a combination of traditional init scripts and upstart scripts. Managing init scripts is covered by other answers. The following is one way to stop an upstart service from starting on boot:

# mv /etc/init/servicename.conf /etc/init/servicename.conf.disabled

The problem with this method is that it does not allow you to start the service using:

# service start servicename

An alternative to this is to open the servicename.conf file in your favorite editor and comment out any lines that start with:

start on

That is, change this to

#start on ...

where the "..." is whatever was after "start on" previously. This way, when you want to re-enable it, you don't have to remember what the "start on" parameters were.

Finally, if you have a new version of upstart you can simply add the word "manual" to the end of the configuration file. You can do this directly from the shell:

# echo "manual" >> /etc/init/servicename.conf

This will cause upstart to ignore any "start on" phrases earlier in the file.


On recent Fedora and Future RHEL systems

systemctl disable httpd.service

will disable the httpd service