If you have a service/daemon you don't want to be started by default at the startup you probably know that you can use a command like this one to deactivate the service:

Removing any system startup links for /etc/init.d/apache2 ...  
/etc/rc0.d/K09apache2  
/etc/rc1.d/K09apache2  
/etc/rc2.d/S91apache2  
/etc/rc3.d/S91apache2  
/etc/rc4.d/S91apache2  
/etc/rc5.d/S91apache2  
/etc/rc6.d/K09apache2

The problem, though, will be with when you update your server with a "aptitude update && aptitude -y safe-upgrade" (or alike). Why? Just check out the post scripts of Apache at /var/lib/dpkg/info/apache2.2-common.postinst:

94 # Automatically added by dh_installinit  
95 if [ -x "/etc/init.d/apache2" ]; then  
96         update-rc.d apache2 defaults 91 09 >/dev/null || exit $?  
97 fi  
98 [...]

You see that update-rc.d command? It enables the service again :( That means that at the next reboot, Apache will start again. Lucky you. And this is exactly what you don't want to.

One possible solution is this one:

cat "DPkg::Post-Invoke {" update-rc.d -f apache2 remove";};  " >
/etc/apt/apt.conf.d/00apache_no_boot

What that does is to create a script that will be executed every time you run apt or aptitude and after its execution (post-invoke) will run the given command. In our case, it will run "update-rc.d -f apache2 remove". So if there is an Apache update, the Apache postscript will activate the Apache service on the startup and we will disable it just after that. Pretty neat, right?

Is you are using upstart its easier. Just execute the following command and you are done:

echo "manual" > /etc/init/apache2.override

Take care!