Stop apache2, mysql from starting automatically

MySQL 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