1.下载文件到download文件
cd /download
wgethttp://mirrors.axint.net/apache/httpd/httpd-2.4.2.tar.gz
wgethttp://mirrors.axint.net/apache/apr/apr-1.4.6.tar.gz
wgethttp://mirrors.axint.net/apache/apr/apr-util-1.4.1.tar.gz
wgetftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
2.解压文件
tar zxvf httpd-2.4.2.tar.gz
tar zxvf apr-1.4.6.tar.gz
tar zxvf apr-util-1.4.1.tar.gz
tar zxvf pcre-8.30.tar.gz
3、移动apr到srclib
mv apr-1.4.6 httpd-2.4.2/srclib/apr
mv apr-util-1.4.1 httpd-2.4.2/srclib/apr-util
4.安装pcre-8.30(--prefix 指的是安装文件目录)cd /tmp/pcre-8.30
./configure
make
make install
5、安装apache-2.4(安装目录为/usr/local/apache)
cd /tmp/httpd-2.4.2
./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
make && make install
cp -f build/rpm/httpd.init /etc/init.d/httpd
chmod +x /etc/init.d/httpd
chkconfig --add httpd
chkconfig httpd on
cd /etc
mv httpd httpd_old
ln -s /usr/local/apache/ httpd
cd /usr/sbin/
ln -fs /usr/local/apache/bin/httpd
ln -fs /usr/local/apache/bin/apachectl
cd /var/log
rm -rf httpd/
ln -s /usr/local/apache/logs httpd
# service httpd restart