1.安装base reop源

 cd /etc/yum.repos.d

2.接着备份旧的配置文件

sudo mv CentOS-Base.repo CentOS-Base.repo.bak

3.下载阿里源的文件

sudo wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

4.安装epel repo源:
epel(RHEL 7)

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

5.清理缓存

yum clean all

6.重新生成缓存

yum makecache