安装wget:
yum -y install wget
1备份原来的CentOS-Base.repo文件
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
3运行 yum makecache 生成缓存