1、自动配置epel源,要给脚本执行权限
[root@localhost ~]# cat nginx.sh
#!/bin/bash
echo "--------------------------"
echo "--------------------------"
echo "change firewall status and selinux"
echo "--------------------------"
echo "--------------------------"
sleep 10
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
cat >> /etc/yum.repos.d/epel.repo << end
[epel]
name=aliyun epel
baseurl=http://mirrors.aliyun.com/epel/7Server/x86_64/
gpgcheck=0
end
rpm -qa |grep nginx
if [ $? -eq 0 ];then
echo "--------------------------"
echo "--------------------------"
echo "this nginx maybe installed!"
echo "--------------------------"
echo "--------------------------"
else
yum install -y nginx
fi
转载:https://blog.csdn.net/tladagio/article/details/101363413
查看评论