1,下载相关软件
# Apache
> wget http://archive.apache.org/dist/httpd/httpd-2.4.39.tar.gz
# pcre
> wget ftp://ftp.pcre.org/pub/pcre/pcre-8.39.tar.gz
# apr & apr-util
> wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gz
> wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
2,编译pcre
> ./configure –prefix=/usr/local/pcre-8.39
> make && make install
3,复制apr和apr-util到httpd的源码目录
> cp -r ./apr-1.7.0 /xxx/software/httpd-2.4.39/srclib/apr
> cp -r ./apr-util-1.6.1 /xxx/software/httpd-2.4.39/srclib/apr-util
4,编译httpd
> ./configure –prefix=/data/apps/httpd2.4.39/ –with-pcre=/usr/local/pcre-8.39/bin/pcre-config –with-included-apr
> make && make install
注意,第3步是必要步骤,否则make的时候会报错:
collect2: error: ld returned 1 exit status make[2]: *** [htpasswd] Error 1 make[2]: Leaving directory `/xxx/software/httpd-2.4.39/support' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/xxx/software/httpd-2.4.39/support' make: *** [all-recursive] Error 1