1、备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
注意:修改Centos-7.repo文件将所有$releasever替换为7
vim /etc/yum.repos.d/CentOS-Base.repo
:%s/$releasever/7/g
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
3、之后运行yum makecache生成缓存
yum makecache