先去網上下載四個文件
1、apr-1.4.6.tar.gz
2、apr-util-1.5.1.tar.gz
3、pcre-8.32.tar.gz
4、httpd-2.4.3.tar.gz
這些都是安裝Apache必須的文件,而且很好下載。
http://pan.baidu.com/share/link?shareid=169366&uk=1829018343
這個是我上傳的,截至到2013-01-10日這些文件都是最新的版本
1、 apr-1.4.6.tar.gz
tar xzf apr-1.4.6.tar.gz
./configure --prefix=/usr/local/apr
(如果上面安裝過程出現/bin/rm: cannot remove `libtoolT’: No such file or directory這個問題,解決辦法 vi configure 找到$RM “$cfgfile”這行刪掉)
make && make install
2、 apr-util-1.5.1.tar.gz
tar xzf apr-util-1.5.1.tar.gz
./configure --with-apr=/usr/local/apr
make && make install
3、 prce
tar xzf pcre-8.32.tar.gz
./configure --prefix=/usr/local/prce
make && make install
4、 apache
tar xzf httpd-2.4.3.tar.gz
./configure -prefix=/usr/local/apache --with-apr=/usr/local/apr/ --with-pcre=/usr/local/prce/
make && make install
檢查一下apache是否正確安裝
/usr/local/apache/bin/apachectl -t
(出現AH00557: httpd: apr_sockaddr_info_get() failed for Chunk3這個問題,解決辦法, vi /usr/local/apache/conf/httpd.conf 找到#ServerName www.example.com:80 這行,把注釋拿掉,然后改成ServerName localhost:80)
啟動apache
service httpd start
(出現httpd: unrecognized service這個問題,解決辦法
#cd /usr/local/apache/bin/
#cp apachectl /etc/rc.d/init.d/httpd
#vi /etc/rc.d/init.d/httpd
在#!/bin/sh這行下增加
# chkconfig: 2345 50 90
# description:Activates/Deactivates Apache Web Server)