Linux – How to Get Apache to Start at Boot Time

apache-2.2linuxstartup

I have installed Apache 2 from source on my Linux box. apachectl -k start works just fine, but how do I get Apache to start at boot time?

This is on a Red Hat Linux distribution:

Linux <hostname> 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686 i686 i386 GNU/Linux

Best Answer

You want to add its init script to the appropriate run level. The init script is typically /etc/init.d/apache2 where you could manually run /etc/init.d/apache2 start to start it.

On Gentoo you would write:

rc-update add apache2 default

On Ubuntu/Debian this works:

sudo update-rc.d apache2 defaults

On Red Hat Linux/Fedora/CentOS a little googling shows this:

chkconfig --add httpd

It varies a little bit from distribution to distribution , but the idea is usually the same. Basically, all these commands make a symbolic link from /etc/init.d/ to the appropriate run-level folder in /etc/.

Related Topic