CentOS 6已经随着2020年11月的结束进入了EOL(Reaches End of Life),不过有一些老设备依然需要支持,CentOS官方也给这些还不想把CentOS 6扔进垃圾堆的用户保留了最后一个版本的镜像,只是这个镜像不会再有更新了
官方便在12月2日正式将CentOS 6相关的软件源移出了官方源,随之而来逐级镜像也会陆续将其删除。
1、首先把fastestmirrors关了:
#编辑 vi /etc/yum/pluginconf.d/fastestmirror.conf #修改 enable=0 #或者执行以下命令 sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf
2、把之前的repo备份:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
3、查看CentOS版本:
cat /etc/redhat-release
4、更改源镜像为阿里云镜像,版本设置为系统的版本:
vim /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-6.5 - Base baseurl=http://mirrors.aliyun.com/centos-vault/6.5/os/x86_64/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 [updates] name=CentOS-6.5 - Updates baseurl=http://mirrors.aliyun.com/centos-vault/6.5/updates/x86_64/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 [extras] name=CentOS-6.5 - Extras baseurl=http://mirrors.aliyun.com/centos-vault/6.5/extras/x86_64/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 [centosplus] name=CentOS-6.5 - Plus baseurl=http://mirrors.aliyun.com/centos-vault/6.5/centosplus/x86_64/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 [contrib] name=CentOS-6.5 - Contrib baseurl=http://mirrors.aliyun.com/centos-vault/6.5/contrib/x86_64/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
5、更新yum:
yum update
完成!
转载请注明:永盟博客 » 修复yum无法安装、更新等问题