My os is 11.04.
I have apache2
& mysql
installed.
How to stop apache2, mysql from starting automatically as computer starts?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityMySQL is handled by upstart. In 11.04 you can use the new override feature to modify the starting behaviour:
echo "manual" >> /etc/init/mysql.override
See the section "Disabling a Job from Automatically Starting" in the Upstart Cookbook
Apache still uses traditional SysV init scripts so you use
update-rc.d -f apache2 remove
to remove the links from /etc/rcX.d
or, alternatively, use
update-rc.d apache2 disable
which "disables" the script by changing it from a start script S91apache2
to a stop script K09apache2
. This is reversible by update-rc.d apache2 enable
.
sudo
- and that why the file is created as your user, not as a root. You can use such command: sudo su -c 'echo "manual" >> /etc/init/mysql.override'
.
May 4, 2011 at 18:27
Interestingly, it's a different answer for each package in 11.04.
sudo update-rc.d -f apache2 remove
echo "manual" | sudo tee /etc/init/mysql.override
To learn more about override files, see: The Upstart Cookbook
This thread will help you: https://superuser.com/questions/35151/how-do-i-stop-services-from-starting-on-boot-on-ubuntu
update-rc.d is a good CLI tool to do this. The linked page has an example involving apache2
It was't working for me. When trying to disable mysql in ubuntu I was receiving the message:
System start/stop links for /etc/init.d/mysql do not exist.
So I found a work around in this link: http://forum.linode.com/viewtopic.php?t=5594
sudo mkdir /etc/init.disabled
sudo mv /etc/init/mysql.conf /etc/init.disabled/
And that's it.
With heavy adoption of systemd
as system manager and init system for debian based distributions like ubuntu , we can now use systemctl
commands to prevent a service from automatically starting at boot.
for example :
sudo systemctl disable apache2
To start using it when required , you can use:
sudo systemctl start apache2
To stop using it, you can use:
sudo systemctl stop apache2
And to see if it's running or not , you can use :
sudo systemctl status apache2
use rcconf to enable/disable a service to auto run on boot.
sudo apt-get install rcconf
Now, type sudo rcconf
And you will see list of services that are installed on your Ubuntu machine. Those marked with star are auto run during boot process. To disable Apache, MySql just navigate to it using arrows and press space bar. Then navigate to OK button using Tab key and again press Space to save configuration.