1.下载库包
wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
2.解压安装
a
[root@xt test]# tar -zxf apr-1.4.5.tar.gz
[root@xt test]# cd apr-1.4.5
[root@xt apr-1.4.5]# ./configure --prefix=/usr/local/apr
[root@xt apr-1.4.5]# make && make install
b
[root@xt test]# tar -zxf apr-util-1.3.12.tar.gz
[root@xt test]# cd apr-util-1.3.12
[root@xt apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr-1-config
[root@xt apr-util-1.3.12]# make && make install
c
[root@xt test]#unzip -o pcre-8.10.zip
[root@xt test]#cd pcre-8.10
yum -y install gcc-c++
[root@xt pcre-8.10]#./configure --prefix=/usr/local/pcre --disable-shared --with-pic
[root@xt pcre-8.10]#make && make install
d
yum -y install pcre-devel
3
下载zlib-1.2.3.tar.gz放在/usr/local目录下执行以下命令:
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
vi Makefile
找到 CFLAGS=-O3 -DUSE_MMAP
在后面加入-fPIC,即变成CFLAGS=-O3 -DUSE_MMAP -fPIC
make && make install
4.安装OpenSSL库
./config --prefix=/usr/local/openssl
yum -y install openssl-devel
ln -s /usr/lib64/libm.so /usr/lib/libm.so
ln -s /usr/lib64/libexpat.so /usr/lib/libexpat.so
5.正式安装
./configure --prefix=/home/yxt/soft/apache --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config --with-pcre=/usr/local/pcre/bin/pcre-config --with-zlib-1.2.3=/usr/local/zlib-1.2.3 --enable-so --with-ssl=/usr/local/openssl/
可能出现的错误:
collect2: ld returned 1 exit status
make[2]: *** [ab] Error 1
make[2]: Leaving directory `/home/yxt/soft/httpd-2.4.29/support‘
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/yxt/soft/httpd-2.4.29/support‘
make: *** [all-recursive] Error 1