Ubuntu下安装Apache2.4.7

今天做一个MetaSploit渗透测试实验,需要的Web环境是Apache2.4.7, Ubuntu版本Ubuntu 16.04…2 LTS。安装这个Apache用了将近一个下午的时间,收集了不少资料,才搞定。现在总结一下,与大家分享,希望遇到同样问题的可以少走弯路。

步骤:

首先下载Apache2.4.7压缩包,http-2.4.7.tar.gz ,解压后进入到http-2.4.7目录,然后执行如下命令:

./configure

如果遇到如下报错:

checking for APR... no
configure: error: APR could not be located. Please use the --with-apr option

先不用着急,下载apr压缩包apr-1.4.6.tar ,然后解压到指定目录,进入解压后的目录,执行如下命令:

cd apr-1.4.6
./configure  --prefix=/usr/local/apr
make&&make install

安装完apr之后。还需要下载apr-util工具包apr-util-1.4.1.tar.gz,解压后,进入到解压后的目录,执行如下命令:

cd apr-util-1.4.1
./configure  --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make&&make install

下载pcre-8.33.zip压缩包,解压后,进入解压后的目录,执行如下命令:

cd pcre-8.33
./configure --prefix=/usr/local/pcre
make&&make install

最后回到http-2.4.7目录下,执行如下命令:

cd http-2.4.7
./configure --prefix=/usr/local/apache --enable-so --enable-modules=all --enable-mods-shared=all
sudo make --with-apr=/usr/local/apr --with-apr-util=/usr/loca/apr-util --with-pcre=/usr/loca/pcre

make&&make install

至此Apache2.4.7安装完毕。