First you gotta have some kind of shell script that you want to run on startup; say /etc/init.d/httpd.
Apache2 should run on boot, so we make a symbolic link to it in one (or more) run levels; e.g. /etc/rc5.d/.
# whoami root # cd /etc/rc5.d/ # ln -s ../init.d/httpd S85httpd # ls -la | grep httpd lrwxrwxrwx 1 root root 15 Mar 12 10:11 S85httpd -> ../init.d/httpd
Now the /etc/init.d/httpd script will run the next time the system boots to run level 5.