rpm -q httpd
if [ $? -eq httpd ]
then
rpm -e httpd
fi
#安装依赖包
rpm -ivh /mnt/Packages/apr-1.4.8-3.el7.x86_64.rpm
rpm -ivh /mnt/Packages/apr-devel-1.4.8-3.el7.x86_64.rpm
rpm -ivh /mnt/Packages/cyrus-sasl-devel-2.1.26-20.el7_2.x86_64.rpm
rpm -ivh /mnt/Packages/expat-devel-2.1.0-8.el7.x86_64.rpm
rpm -ivh /mnt/Packages/libdb-devel-5.3.21-19.el7.x86_64.rpm
rpm -ivh /mnt/Packages/openldap-devel-2.4.40-13.el7.x86_64.rpm
rpm -ivh /mnt/Packages/apr-util-devel-1.5.2-6.el7.x86_64.rpm
rpm -ivh /mnt/Packages/apr-util-1.5.2-6.el7.x86_64.rpm
rpm -ivh /mnt/Packages/pcre-devel-8.32-15.el7_2.1.x86_64.rpm
rpm -ivh /mnt/Packages/pcre-8.32-15.el7_2.1.x86_64.rpm
#安装源代码包
tar zxf /mnt/tar/httpd-2.4.25.tar.gz -C /usr/src/
cd /usr/src/httpd-2.4.25/
./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi
make
make install
#优化超链接
ln -s /usr/local/httpd/bin/* /usr/local/bin
挂盘
![](https://img-blog.csdnimg.cn/a81b3939af3f40998dacdaea8c9e189f.png)
mount /dev/sr0 /mnt
运行脚本(安装时间可以直接开第二个桌面做第三套)
. http.sh
## 二,第二套
systemctl stop firewalld
setenforce 0
ifconfig ens33 192.168.1.1
1. 配置两个httpd虚拟主机
vim /usr/local/httpd/conf/extra/httpd-vhosts.conf
2. 第一个域名为[www.bdqn1.com]( ),第二个为[www.bdqn2.com]( )
mkdir /A
mkdir /B
echo “A” > /A/index.html
echo “B” > /B/index.html
htpasswd -c /usr/local/httpd/conf/.passwd xi