httpd安装和设置开机启动

httpd安装的所有程序

[root@localhost soft]# cd apr-1.5.2

[root@localhost apr-1.5.2]# ./configure --prefix=/usr/local/apr

[root@localhost apr-1.5.2]# make

[root@localhost apr-1.5.2]# make install

[root@localhost apr-1.5.2]# cd ../apr-util-1.5.4

[root@localhost apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config

[root@localhost apr-util-1.5.4]# make

[root@localhost apr-util-1.5.4]# make install

[root@localhost apr-util-1.5.4]# cd ../pcre-8.38

[root@localhost pcre-8.38]# ./configure --prefix=/usr/local/pcre --with-apr=/usr/local/apr/bin/apr-1-config

[root@localhost pcre-8.38]# make

[root@localhost pcre-8.38]# make install

[root@localhost pcre-8.38]# cd ../httpd-2.4.18

[root@localhost httpd-2.4.18]# ./configure --prefix=/usr/local/httpd --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

----apr、apr-util和pcre 的路径是编译路径不是安装路径

[root@localhost httpd-2.4.18]# make

[root@localhost httpd-2.4.18]# make install

启动命令:

[root@localhost bin]# ./apachectl start

[root@localhost bin]# ./apachectl stop

[root@localhost bin]# ./apachectl restart

开机启动设置:

将链接apachectl 复制到系统启动目录下并命名为httpd

[root@localhost bin]# cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd

到此,其实已经可以使用service httpd start等命令,但在linux服务列表还没有注册

使用chkconfig来注册apache服务,并其可以在linux的服务列表中看到(chkconfig –list)

在init.d的httpd链接文件中第2行添加如下注释,并wq保存退出

[root@localhost bin]#  vim /etc/rc.d/init.d/httpd

意义如下

35:在3级别和5级别(级别见文末TIPS)启动httpd

61:启动顺序为61号,S61

61:关闭顺序为61号,K61

当进行chkconfig --add httpd操作时,如果没有指定level那么就会来这个注释中取值

此时,就可以在rc.d下的相应的3和5目录下看到S61httpd,并在0、1、2、4、6目录看到K61httpd了

这是2步的手动设置方式,不想看可以跳过。可以手动设置自启动:将链接apachectl放一份软链接到rc3.d目录下(和/或rc*.d目录下)

[root@localhost bin]# ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S61httpd
这样,已经设置了在“有网络多用户命令行模式下”在61顺序自动启动httpd服务了

猜你喜欢

转载自blog.csdn.net/shardy0/article/details/87715096
今日推荐