How to auto-start a service (apache2) with Linux Mint

Debian (Ubuntu/Linux Mint)

rcconf (CLI-GUI)

sudo apt-get install rcconf
sudo rcconf

update-rc.d

sudo update-rc.d -f apache2 add

or

sudo update-rc.d apache2 defaults

RedHat/Fedora/CentOS

chkconfig

sudo chkconfig --add apache2

or

sudo chkconfig -- level 35 apache2 on

Since Mint is based on Ubuntu, and Ubuntu has switched to Upstart, the Upstart Cookbook has all of the info for having a service start on boot, or at any specified runlevel.

This site Gives a detailed cookbook for starting Apache at boot.


Another cause of the same problem is the priority of the apache links in rc[0-6].d. Mine were S90 and K09, and Apache wouldn't start at boot. Setting the priorities at their defaults, 20, worked for me. The existing links need to be removed first.

sudo update-rc.d -f apache2 remove
sudo update-rc.d apache2 defaults