1. 程式人生 > >【已解決】安裝 apache2.4 make 報錯

【已解決】安裝 apache2.4 make 報錯

問題示例:

make[2]: *** [htpasswd] Error 1
make[2]: Leaving directory `/usr/local/httpd-2.4.33/support'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/httpd-2.4.33/support'
make: *** [all-recursive] Error 1

1.安裝依賴包

wget -c http://archive.apache.org/dist/apr/apr-1.6.2.tar.gz
tar -xf
apr-1.6.2.tar.gz cd apr-1.6.2 ./configure --prefix=/usr/local/apr make && make install wget -c http://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz tar -xf apr-util-1.6.1.tar.gz cd apr-util-1.6.1 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config make && make install wget -c
https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.gz tar -xf pcre-8.41 cd pcre-8.41 ./configure --prefix=/usr/local/pcre make && make install

2.編譯安裝apache

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

可能會出現的問題

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

解決方法:
把解壓好的apr和apr-util 複製到 /httpd-2.4.33/srclib/ 中去

cp -r apr-1.6.1 /usr/local/src/httpd-2.4.33/srclib/apr
cp -r apr-util-1.6.2 /usr/local/src/httpd-2.4.33/srclib/apr-util

3.重新編譯

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

看看有沒有報錯,沒有的話繼續安裝

make && make install

完成安裝

image.png