1.[root@likk~]#cp /user/local/apache2/bin/apachectl /etc/init.d/httpd
2.[root@likk~]#vim /etc/init.d/httpd
行首加入如下配置:
#!/bin/sh
#chkconfig: 2345 85 15
2345表示2345四个启动级别里面加载这个服务,85表示启动(开机时)顺 序号,15表示关闭(关机时)顺序号
#description: httpd is web server 描述信息
3.[root@likk~]#chkconfig --add httpd
4.[root@likk~]#chkconfig httpd on
当然大家如果嫌弃上面的步骤麻烦又想让服务开机启动可以使用命令:
echo "/usr/local/apache-2.2.15/bin/apachectl start" >> /etc/rc.local
转载于:https://blog.51cto.com/wenqiangit/1571428