1、如果没有安装wget就先安装wget
yum -y install wget
2、进入yum.repos.d
cd /etc/yum.repos.d
3、备份CentOS-Base.repo文件
mv CentOS-Base.repo CentOS-Base.repo.bak
4、下载阿里源的Centos-7.repo
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
5、 安装epel repo源:
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
6、清理一下缓存
yum clean all
7、重新生成缓存
yum makecache