1、下载wget软件并验证
yum install wget -y
wget
2、备份旧的yum源
cd /etc/yum/yum.repos.d/
mkdir repo-bak
mv ./* ./repo-bak/
3、安装阿里巴巴Yum源:(阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区)
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
4、安装epel源
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
5、安装nginx
yum install nginx -y
6、重启
systemctl start nginx