0x01 yum安装所需依赖


yum install -y wget gcc gcc-c++ expat-devel

可选yum安装以下组件


yum install -y apr-devel apr-util-devel pcre-devel

0x02 下载所需组件源码并编译


https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.39.tar.gz
https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gz
https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.43.tar.gz

0x02 编译安装apr


tar -zxvf apr-1.7.0.tar.gz
cd apr-1.7.0
./configure --prefix=/usr/local/apr
make &&make install

0x02 编译安装apr-util


tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make &&make install

0x02 编译安装pcre


tar -zxvf /pcre-8.43.tar.gz
cd pcre-8.43
./configure --prefix=/usr/local/pcre
make &&make install

0x03 编译apache


0x03 把 apr、apr-util的文件夹复制到 apache目录 srclib


 tar -zxvf httpd-2.4.39.tar.gz
 cp -r apr-1.7.0 httpd-2.4.39/srclib/apr
 cp -r apr-util-1.6.1 httpd-2.4.39/srclib/apr-util

0x03 正式编译


cd httpd-2.4.39
./configure --with-included-apr --prefix=/usr/local/apache2 --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/
make &&make install

启动Apache httpd服务
/usr/local/apache2/bin/apachectl start


防火墙开放80端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
systemctl restart firewalld

Last modification:July 27th, 2020 at 05:20 pm
If you think my article is useful to you, please feel free to appreciate