Linux 自动化安装httpd---只为解决小白的烦恼
!/bin/bash
#install apache
#v1.0 by shuaib 2020-6-11
ping -c1 www.baidu.com &>/dev/null
if [ $? -eq 0 ];then
yum -y instll httpd
systemctl start httpd
systemctl enable httpd
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
sed -ri '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config
setenforce 0
curl http://127.0.0.1 &>/dev/null
if [ $? -eq 0 ];then
echo "Apache ok..."
fi
elif
echo "connect :unreachable!check gateway"
read -p "please input gateway: " gateway
ping -c1 $gateway &>/dev/null;then
echo "check dns..."
else
echo "check ip address..."
fi