环境:CentOS6.5
apache版本:5.6.40
1.下载源码包
cd /home
mkdir apache_source_code
cd apache_source_code
wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.34.tar.gz
2.解压源码包
tar -zxvf httpd-2.4.33.tar.gz
cd httpd-2.4.33
3.设置配置参数
./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
但是报错'APR not found',需要先安装 APR
4.安装apr
cd /home
mkdir apr_source
cd apr_source
wget http://mirror.bit.edu.cn/apache/apr/apr-1.6.3.tar.gz
tar -zxvf apr-1.6.3.tar.gz
cd apr-1.6.3
./configure --prefix=/usr/local/apr
make && make install
5.安装apr-util
yum install expat-devel -y
cd /home
mkdir apr-util_source
cd apr-util_source
wget http://mirror.bit.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1.tar.gz
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
6.安装pcre
cd /home
mkdir pcre_source_code
cd pcre_source_code
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
unzip pcre-8.10.zip
cd pcre-8.10
./configure --prefix=/usr/local/pcre
make && make install
7.设置编译参数
./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --with-included-apr
8.讲apr与apr-util复制到对应位置
9.cd /home/apache_source_code/httpd-2.4.33/srclib
mv /home/apr-util_source_code/apr-util-1.6.1 apr-util
mv /home/apr_source_code/apr-1.6.3 apr
10.安装
make && make install
10.启动apache
cd /usr/local/apache/bin
./apachectl -k start