CentOS6停止所有更新后,yum更新源的替代方案
问题描述
CentOS 6已经随着2020年11月的结束进入了EOL(Reaches End of Life)。所以在2020年12月2日,CentOS官方停止了对CentOS 6的所有更新,并且下架了包括官方所有的CentOS6源,目前阿里、163、清华等CentOS6源已无法使用。
以下官方redme文档的解释:
This directory (and version of CentOS) is deprecated. Please see this FAQ concerning the CentOS release scheme:
https://wiki.centos.org/About/Product
Please keep in mind that 6.0, 6.1, 6.2, 6.3, 6.4 , 6.5, 6.6, 6.7, 6.8 , 6.9 and 6.10 no longer get any updates, nor any security fix’s. The whole CentOS 6 is dead and shouldn’t be used anywhere at all
目前的各个版本的最后维护更新时间,如下。
- CentoS 6 停止维护更新日期2020年11月30日
- CentOS 7 停止维护更新日期2024年6月30日
- CentOS 8 停止维护更新日期2029年5月31日
官方地址:https://wiki.centos.org/About/Product
所以,各位在企业生产中有用到相关的版本时,需要在这些时间节点注意下切换、升级。
因此,目前在CentOS6系统上执行Yum命令时会提示上图的404错误。
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* city-fan.org-source: www.city-fan.org
* 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"
Trying other mirror.
To address this issue please refer to the below wiki article
https://wiki.centos.org/yum-errors
If above article doesn't help to resolve this issue please use https://bugs.centos.org/.
http://mirrors.cloud.aliyuncs.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.
如果,还有部分系统没有来的及升级、切换的,或者由于一些原因还要继续使用CentOS6的话,肯定还是有解决方法的。
解决方案:
可以使用 http://vault.centos.org 作为更新源即可
CentOS官方:http://vault.centos.org/
阿里云镜像:http://mirrors.aliyun.com/centos-vault/
解决方案
具体的操作步骤如下:
1、关闭fastestmirror
vi /etc/yum/pluginconf.d/fastestmirror.conf
#修改参数
enable=0
2、将原来的源改名,习惯备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
3、更换源
#替换为官方Vault源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://allen-hz-bucket.oss-cn-hangzhou.aliyuncs.com/centos/Centos-6-Vault-Official.repo
#或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://allen-hz-bucket.oss-cn-hangzhou.aliyuncs.com/centos/Centos-6-Vault-Official.repo
#替换为阿里云Vault镜像
wget -O /etc/yum.repos.d/CentOS-Base.repo http://allen-hz-bucket.oss-cn-hangzhou.aliyuncs.com/centos/Centos-6-Vault-Aliyun.repo
#或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://allen-hz-bucket.oss-cn-hangzhou.aliyuncs.com/centos/Centos-6-Vault-Aliyun.repo
#替换之后运行 yum makecache 生成缓存
yum clean metadata
如果系统无wget命令,无法下载文件时,可以使用上的面地址中的内容,直接编辑原来的Yum源文件互替换即可。
出处:https://liaoxingyu.cn/archives/centos6-new-yum