cenos6.x yum源过期替换问题 尝试其他镜像

2020年11月30日CentOS 6 EOL。按照社区规则
CentOS 6的源地址 http://mirror.centos.org/centos-6/内容已移除
目前第三方的镜像站(阿里云和163)中均已移除CentOS 6的源。
阿里云的源 http://mirrors.cloud.aliyuncs.com和 http://mirrors.aliyun.com也无法同步到CentOS 6的源。
当您在阿里云上继续使用默认配置的CentOS 6的源会发生报错。报错示例如下图所示:

在这里插入图片描述

解决方法

替换为阿里的centos-vault源
centos-vault是专门为过期的镜像的保存地址。

找到/etc/yum.repos.d/CentOS-Base.repo

将文件中的$releasever替换成你centos的具体版本。

可以使用
cat /etc/redhat-release
查看版本
在这里插入图片描述
我这里就需要将$releasever替换成6.9

然后将所有的/centos/替换成/centos-vault/保存文件即可。
在这里插入图片描述

最后运行
yum clean all
yum makecache

然后就可以使用了。

这里附上一份我修改好的6.9的文件,有需要可以自取

# 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.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.9/os/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/6.9/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/6.9/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-6.9 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.9/updates/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/6.9/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/6.9/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-6.9 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.9/extras/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/6.9/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/6.9/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.9 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.9/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/6.9/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/6.9/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.9 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.9/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/6.9/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/6.9/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值