sunny123456

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

Centos 6 yum使用国内镜像源报404错(centos官方停止并下架了对centos6的更新)

今天在修改yum的安装源,
使用yum makecache的时候
一直报如下的错:
无论阿里,还是163的:

http://mirrors.163.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - “The requested URL returned error: 404 Not Found”
尝试其他镜像。
To address this issue please refer to the below knowledge base article

原因是:
Centos6停止维护更新日期:2020年11月30日
Centos7停止维护更新日期:2024年6月
Centos8停止维护更新日期:2029年5月
2020年12月2日, centos官方停止了对 centos6的所有更新,并且下架了包括官方所有的 centos6源,目
前阿里、163、清华等 centos6源已无法使用

由于 CentOS 6.X 已经停止维护更新,国内所有的镜像源、 yum 源已经更新地址,使用阿里云 yum:http://mirrors.aliyun.com/centos-vault/ 寻找对应自己系统版本

【解决方案1】
目前 vault.centos.org的源还可以用。修改如下:
备份 /etc/yum.repos.d/CentOS-Base.repo

修改 /etc/yum.repos.d/CentOS-Base.repo 内容为:

[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/centos-vault/6.9/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.aliyun.com/centos-vault/6.9/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

#清除和缓存

 yum clean all   
 yum makecache
  • 1
  • 2

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.
http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - “couldn’t connect to host”
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - “Couldn’t resolve host ‘mirrors.cloud.aliyuncs.com’”
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

【解决方案2】

cd /etc/yum.repos.d
vi CentOS-Base.repo
:%s/$releasever/7/g
  • 1
  • 2
  • 3

#将文件中$releasever全部改成7
yum clean all && yum makecache # 清除和缓存
清空、生成缓存:执行

https://blog.csdn.net/rzhidong/article/details/113596301
posted on 2022-09-08 16:36  sunny123456  阅读(407)  评论(0编辑  收藏  举报