apache-2.2与新出的apache-2.4安装不同的地方在于,2.4版的已经不自带apr库,所以在安装apache-2.4之前,需要下载apr。
1、下载软件

cd /tmp
wget http://labs.mop.com/apache-mirror/httpd/httpd-2.4.3.tar.gz
wget http://labs.mop.com/apache-mirror/apr/apr-1.4.6.tar.gz
wget http://labs.mop.com/apache-mirror/apr/apr-util-1.4.1.tar.gz
tar xzf httpd-2.4.3.tar.gz
tar xzf apr-1.4.6.tar.gz
tar xzf apr-util-1.4.1.tar.gz

2、安装编译环境基本包

yum -y install gcc gcc-c++ glibc glibc-common pcre-devel autoconf make automake zlib-devel lua-devel libxml2-devel openssl-devel

3、移动apr到srclib

mv apr-1.4.6 httpd-2.4.3/srclib/apr
mv apr-util-1.4.1 httpd-2.4.3/srclib/apr-util

4、安装apache-2.4

cd /tmp/httpd-2.4.3
./configure --prefix=/usr/local/apache2 --enable-so --enable-deflate=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
mkdir -p httpd/conf.d
ln -s /usr/local/apache/conf httpd/conf
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
*/

转载请注明

http://www.centos.bz/2012/05/apach-2-4-x-compile-install/