Linux 编译安装apache添加chkconfig自启动的方法
时间:2016-01-02 20:22 来源:linux.it.net.cn 作者:IT
实际安装路径以您真实的安装路径为准,这里apache安装的路径为/usr/local/apache/
1、首选需要将/usr/local/apache/bin/apachectl文件拷贝到/etc/rc.d/init.d 目录中并更名为httpd
具体操作命令为cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
并且还需要在/etc/rc.d/rc5.d/加入链接。
具体操作命令为 ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S85httpd

2、这时可以运行chkconfig --list | grep httpd,查看服务列表中是否存在httpd这个服务,如果没有,可以通过chkconfig --add httpd来添加。如果在添加时出现提示:service httpd does not support chkconfig

需要编辑/etc/rc.d/init.d/httpd,在文件空白行添加以下信息,可以使用vi进行编辑操作
#chkconfig: 345 85 15
#description: Activates/Deactivates Apache Web Server
其中3个数字参数意义分别为:哪些Linux级别需要启动httpd(3,4,5);启动序号(85);关闭序号(15)
保存后执行:chkconfig --add httpd 成功添加

3、运行chkconfig --list | grep httpd查看启动级别3,4,5 已经处于on的状态,说明已经设置成功。

(责任编辑:IT)
实际安装路径以您真实的安装路径为准,这里apache安装的路径为/usr/local/apache/
2、这时可以运行chkconfig --list | grep httpd,查看服务列表中是否存在httpd这个服务,如果没有,可以通过chkconfig --add httpd来添加。如果在添加时出现提示:service httpd does not support chkconfig
需要编辑/etc/rc.d/init.d/httpd,在文件空白行添加以下信息,可以使用vi进行编辑操作 保存后执行:chkconfig --add httpd 成功添加
3、运行chkconfig --list | grep httpd查看启动级别3,4,5 已经处于on的状态,说明已经设置成功。
|