如果您之前一直正常使用,而现在2021年1月开始无法yum了,那就是下面我说的原因了。
原因是:官方移除了centos的软件源
解决办法:
五行命令,五步
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
上面使用的是阿里云,也就是国内的,如果服务器是海外,则把第三条命令替换为官方Vault源(海外服务器用)
curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Official.repo
注意:下载的repo是针对centos6.10的,如果您不是这个版本请把版本号替换一下,比如我就替换为6.9
官方历史存档地址:https://vault.centos.org/
阿里云历史存档地址:http://mirrors.aliyun.com/centos-vault/
另外阿里服务器源里还有个epel.repo的文件,目前我没找到存档源的替换地址,可以先把文件名加个bak后缀把它先屏蔽掉。
参考文章:
2020年12月之后 Centos 6无法使用yum解决办法:https://blog.csdn.net/zhs260133172/article/details/111403417
附:
海外6.9的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.9 - Base - vault.centos.org failovermethod=priority baseurl=http://vault.centos.org/6.9/os/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-6.9 - Updates - vault.centos.org failovermethod=priority baseurl=http://vault.centos.org/6.9/updates/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-6.9 - Extras - vault.centos.org failovermethod=priority baseurl=http://vault.centos.org/6.9/extras/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-6.9 - Plus - vault.centos.org failovermethod=priority baseurl=http://vault.centos.org/6.9/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-6.9 - Contrib - vault.centos.org failovermethod=priority baseurl=http://vault.centos.org/6.9/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6
国内6.9的repo(非阿里云EC2服务器 mirrors.cloud.aliyuncs.com 改为 mirrors.aliyun.com)
# 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.9 - Base - mirrors.cloud.aliyuncs.com failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.9/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-6.9 - Updates - mirrors.cloud.aliyuncs.com failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.9/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-6.9 - Extras - mirrors.cloud.aliyuncs.com failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.9/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-6.9 - Plus - mirrors.cloud.aliyuncs.com failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.9/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-6.9 - Contrib - mirrors.cloud.aliyuncs.com failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.9/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
相关文章