一、源码包安装服务的启动

  1. 使用绝对路径,调用启动脚本来启动。不同的源码包的启动脚本不同。可以查看源码包的安装说明,查看启动脚本的方法。
  • apachectl启动服务:/usr/local/apache2/bin/apachectl start|stop

    二、源码包服务的自启动(修改配置文件)

    [root@localhost ~]# vi /etc/rc.d/rc.local
    加入
    /usr/local/apache2/bin/apachectl start

    三、让源码包服务被服务管理命令识别

  1. 让源码包的apache服务能被service命令管理启动(制作软链接)

ln -s /usr/local/apache2/bin/apachectl /etc/init.d/apache

  1. 让源码包的apache服务能被chkconfig与ntsysv命令管理自启动

vi /etc/init.d/apache
# chkconfig: 35 86 76
#指定httpd脚本可以被chkconfig命令管理。格式是:
chkconfig: 运行级别 启动顺序 关闭顺序
# description: source package apache
#说明,内容随意
[root@localhost ~]# chkconfig —add apache
#把源码包apache加入chkconfig命令