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 # 清除和缓存
清空、生成缓存:执行
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)