Apache2.4以上版本在進行編譯時需要安裝apr和apr-util兩個關鍵包,否則編譯不過去。

下載地址:

下載到/usr/local/src下進行解壓。

進入到httpd,進行編譯Apache:

./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre --enable-mods-shared=most --enable-so

問題一:會提示報錯如下

make[2]: *** [exports.lo] Error 1
make[2]: Leaving directory `/usr/local/src/httpd-2.4.7/server'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/httpd-2.4.7/server'
make: *** [all-recursive] Error 1

在./configure後加上--with-include-apr後,

問題二,報錯:

configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.

需要將解壓後的apr兩個包複製到/usr/local/src/httpd-2.4.7/srclib下:

# cp -r apr-1.5.2 /usr/local/src/httpd-2.4.7/srclib/apr

# cp -r apr-util-1.5.4 /usr/local/src/httpd-2.4.7/srclib/apr-util


在進行編譯就好了