1.备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.下载
centOs6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
centOs7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3.备注
如果没有安装wget的,可以先下载到本地在上传到Linux上边。
centOs6:
http://mirrors.aliyun.com/repo/Centos-6.repo
centOs7
http://mirrors.aliyun.com/repo/Centos-7.repo
假如上传到:/etc/yum.repos.d
则可执行以下操作覆盖文件CentOS-Base.repo
#覆盖文件
cp -rf Centos-7.repo CentOS-Base.repo
4.生成缓存
yum makecache