备份
cd /etc/yum.repos.d
mv ./CentOS-Base.repo ./CentOS-Base.repo.bak
mv ./CentOS-Debuginfo.repo ./CentOS-Debuginfo.repo.bak
mv ./CentOS-fasttrack.repo ./CentOS-fasttrack.repo.bak
mv ./CentOS-Media.repo ./CentOS-Media.repo.bak
mv ./CentOS-Vault.repo ./CentOS-Vault.repo.bak
下载新的CentOS-Base.repo
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
运行yum makecache生成缓存
yum makecache