· 系统环境
- 虚拟机VMware 15 Pro
- CentOS release 6.5
- yum源使用阿里云CentOS6(地址:https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b11o0FN4Q)
· 更换yum源步骤
- 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
- 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
# 本文使用curl命令,因yum源不可用且没有weget命令 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
- 运行 yum clean all && yum makecache 清理缓存并重新生成缓存
此时会报错
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"
Trying other mirror.
原因:
CentOS 6已经随着2020年11月的结束进入了EOL(Reaches End of Life),不过有一些老设备依然需要支持,
CentOS官方也给这些还不想把CentOS 6扔进垃圾堆的用户保留了最后一个版本的镜像,只是这个镜像不会再有更新了
官方便在12月2日正式将CentOS 6相关的软件源移出了官方源,随之而来逐级镜像也会陆续将其删除。
解决方法:(亲测有效)
sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
yum clean all && yum makecache
验证:安装weget命令
yum -y install wget
安装成功