一键安装nginx脚本

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
发布了132 篇原创文章 · 获赞 118 · 访问量 25万+

猜你喜欢

转载自blog.csdn.net/tladagio/article/details/101363413