1 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
3 运行 yum makecache 生成缓存
[root@hadoop101 yum.repos.d]# yum makecache
已加载插件:fastestmirror, refresh-packagekit, security
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
http://mirrors.aliyun.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
尝试其他镜像。
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.
http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: (28, 'connect() timed out!')
尝试其他镜像。
http://mirrors.cloud.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.cloud.aliyuncs.com'"
尝试其他镜像。
错误:Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
[root@hadoop101 yum.repos.d]#
4 替换源文件配置, 使用https://mirrors.aliyun.com/centos-vault
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's/http/https/g' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's/$releasever/6.8/g' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's/centos/centos-vault/g' /etc/yum.repos.d/CentOS-Base.repo
5 yum clean all && yum makecache