1)下载apache 所需的安装包(apr-1.5.2.tar.gz 、apr-util-1.5.4.tar.gz、httpd-2.4.16.tar.gz)
[[email protected] tmp]# wget http://mirrors.axint.net/apache//httpd/httpd-2.4.16.tar.gz
[[email protected] tmp]# wget http://mirrors.axint.net/apache//apr/apr-1.5.2.tar.gz
[[email protected] tmp]# wget http://mirrors.axint.net/apache//apr/apr-util-1.5.4.tar.gz
2)解压安装包
[[email protected] tmp]# tar xzvf httpd-2.4.16.tar.gz
[[email protected] tmp]# tar xvzf apr-1.5.2.tar.gz
[[email protected] tmp]# tar xvzf apr-util-1.5.4.tar.gz
3)移动
[[email protected] tmp]# mv apr-1.5.2 httpd-2.4.16/srclib/apr ->httpd-2.4.16/srclib/apr 不能带有版本号
[[email protected] tmp]# mv apr-util-1.5.4 httpd-2.4.16/srclib/apr-util ->httpd-2.4.16/srclib/apr-util 不能带有版本号
4)pcre安装包,在光盘里面可以找到。
[[email protected] Packages]# rpm -ivh pcre-7.8-6.el6.i686.rpm 还有 pcre-devel-7.8-3.1.el6.i686.rpm
5)进入httpd-2.4.16
[[email protected] httpd-2.4.16]# ./configure --prefix=/usr/local/apache --enable-so --enable-deflate=shared --enable-ssl=shared --enable-expires=shared --enable-headers=shared --enable-rewrite=shared --enable-static-support --with-included-apr --with-mpm=prefork
6)编译安装
[[email protected] httpd-2.4.16]# make && make install
7)完成后启动apache
[[email protected] tmp]#/usr/local/apache/bin/apachectl -t 检查语句
Syntax OK
[[email protected] tmp]#/usr/local/apache/bin/apachectl start 启动
[[email protected] tmp]netstat -ntpl | grep ":80"
8)添加apache到系统服务
[[email protected] /]# cp /usr/local/apache/bin/apachectl /etc/init.d/
[[email protected] /]# chmod a+x /etc/init.d/apachectl
[[email protected] /]# vim /etc/init.d/apachectl
#!/bin/sh
#chkconfig:35 61 61
[[email protected] /]# chkconfig --add apachectl
[[email protected] /]# chkconfig --list apachectl
apachectl 0:off 1:off 2:off 3:on 4:off 5:on 6:off
[[email protected] /]# service apachectl stop
[[email protected] /]# service apachectl start