首先备份/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)
CentOS7
CentOS6
CentOS5
运行以下命令生成缓存
yum clean allyum makecache
CentOS镜像使用帮助--yum更新
原文:http://hequan.blog.51cto.com/5701886/1757931