These are my personal notes on enabling/disabling auto start of Mysql and Apache2 on boot (or other services for that matter). Also on how to start/stop these services after boot. The notes are as they are. I hope you find them useful.
All this is done through a terminal. Open one from the Gnome GUI with:
Ctrl-Alt-t
Say you want to stop a service starting on boot. Lets say its the Apache2 webserver…. On the terminal type:
sudo update-rc.d -f apache2 remove
Similarly for MySql or Maria DB (both use the same command)
sudo update-rc.d -f mysql remove
This does Not remove Apache2 or Mysql from your system it simply stops them automatically running when you boot up next time.
The -f flag is mandatory. No flag – no remove.
To do the reverse and make (say) apache2 automatically run next time you boot up, type:
update-rc.d apache2 defaults
All the defaults bit does is to set up apache to be able to run in a number of different run levels on Linux. As you are probably running a GUI (aka Gnome or Unity etc.) you are running at run level 5 so this is fine. If for some reason you did not boot into the GUI (run level 5) Apache2 would still automatically load and run in run level 2,3 or 4.
If (say) you only wanted to automatically run Apache2 when you booted into the GUI (run level 5) type:
sudo update-rc.d apache2 start 20 5 . stop 80 0 1 2 3 6 .
The dots are important. The 20 and the 80 are priority levels. Just leave them as they are should be fine.
To start or stop a service on the fly simply type:
sudo service mysql start
and/or
sudo service apache2 start
stopping….
sudo service apache2 stop
and/or
sudo service mysql stop
If you want to see what state they are in (i.e. check it they are running or not) type:
sudo service apache2 status
and/or
sudo service mysql status