#依赖关系
( gcc -> apr -> apr-util ) + ( g++ -> pcre ) = httpd
#step 0:编译器
yum list gcc 「c编译器」
yum list gcc-c++ 「c++编译器」
#step 1:apr
wget https://mirrors.bfsu.edu.cn/apache//httpd/httpd-2.4.46.tar.gz
tar zxf httpd-2.4.46.tar.gz
cd httpd-2.4.46/
./configure --help 「 选项查询」
mkdir /opt/xx
./configure --prefix=/opt/xx/ 「默认安装位置 /usr/local」
configure: error: APR not found. Please read the documentation.
wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
tar zxf apr-1.4.5.tar.gz
cd apr-1.4.5/
./configure --prefix=/usr/local/apr
make
make install
#step 2:apr-util
cd /usr/local/src/httpd-2.4.46
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr
configure: error: APR-util not found. Please read the documentation.
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
tar zxf apr-util-1.3.12.tar.gz
cd apr-util-1.3.12/
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config --enable-utf8 「依赖apr」
make
make install
#step 3:pcre
cd /usr/local/src/httpd-2.4.46
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
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 「Error 缺少g++」
#错误
libtool: compile: g++ -DHAVE_CONFIG_H -I. -c pcrecpp.cc -o .libs/pcrecpp.o
./libtool: line 990: g++: command not found
make[1]: *** [pcrecpp.lo] Error 1
make[1]: Leaving directory `/usr/local/src/pcre-8.10'
make: *** [all] Error 2
yum install -y gcc-c++
cd /usr/local/src/pcre-8.10
./configure --prefix=/usr/local/pcre
make
make install
#step 4:httpd
cd /usr/local/src/httpd-2.4.46
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
make
make install
#step 5:成功
ls /usr/local/apache/