Cento OS7编译安装Apache后设为服务并开机启动

编译安装Apache后切换到安装目录下的bin目录执行以下命令

 

#  cp apachectl /etc/init.d/httpd  --复制apachectl到/etc/init.d/并命名为httpd

#  cp apachectl /usr/local/bin/httpd

#  ln -s /etc/init.d/httpd  /etc/rc.d/rc5.d/S61httpd

#  ln -s /etc/init.d/httpd  /etc/rc.d/rc4.d/S61httpd

#  ln -s /etc/init.d/httpd  /etc/rc.d/rc3.d/S61httpd

 打开/etc/init.d/httpd文件,在#!/bin/sh下面加入如下代码

  #chkconfig:345 61 61 

  #description:Apache

 注册服务

sudo chkconfig --add httpd

 设为开机启动

sudo chkconfig --levels 345 httpd on

 

 

你可能感兴趣的:(Cento OS7编译安装Apache后设为服务并开机启动)