http://mirror.centos.org/centos/5/addons/x86_64/repodata/repomd.xml错误如何解决

本文介绍了解决YUM源提示无法检索存储库元数据的问题。通过修改CentOS-Base.repo文件中的URL,替换为可用的镜像地址,并更新GPG密钥验证方式,最终解决了错误并确保了系统的稳定运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

查找YUM源提示错误:
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirror.neu.edu.cn
 * extras: mirror.neu.edu.cn
 * updates: mirror.neu.edu.cn

Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its path and try again

 

 

============================================解决方法===========================================

1. cd /etc/yum.repos.d
2. [root@localhost yum.repos.d]# cp CentOS-Base.repo CentOS-Base.repo.bak
 [root@localhost yum.repos.d]# :>CentOS-Base.repo
 [root@localhost yum.repos.d]# vi CentOS-Base.repo

 

 

 

3. 复制以上内容
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/devel/RPM-GPG-KEY-CentOS-5

#released updates
[update]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/devel/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=addons
baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/devel/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/devel/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirrors.163.com/centos/devel/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/devel/RPM-GPG-KEY-CentOS-5

 

 

4. 安装文件时会提示:GPG key retrieval failed: [Errno 14] HTTP Error 404: Not Found
5. 解放方法: yum install vsftp* --nogpgcheck


若出现一下提示 :

Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
    
RHA5
解决办法:
rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5


如果是低版本,可以使用
rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-centos4

[root@localhost yum.repos.d]# yum makecache # 重建元数据缓存 已加载插件:fastestmirror, langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository contrib is listed more than once in the configuration Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository contrib is listed more than once in the configuration Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository contrib is listed more than once in the configuration Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com http://mirrors.163.com/centos/7/addons/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found 正在尝试其它镜像。 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/. One of the configured repositories failed (CentOS-7 - Addons - 163.com), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled yum --disablerepo=addons ... 4. Disable the repository permanently, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable addons or subscription-manager repos --disable=addons 5. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=addons.skip_if_unavailable=true failure: repodata/repomd.xml from addons: [Errno 256] No more mirrors to try. http://mirrors.163.com/centos/7/addons/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found [root@localhost yum.repos.d]# yum repolist 已加载插件:fastestmirror, langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository contrib is listed more than once in the configuration Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository contrib is listed more than once in the configuration Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository contrib is listed more than once in the configuration Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com http://mirrors.163.com/centos/7/addons/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found 正在尝试其它镜像。 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.163.com/centos/7/addons/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found 正在尝试其它镜像。 base/7/x86_64 | 3.6 kB 00:00 base/7/x86_64/group_gz | 153 kB 00:00 base/7/x86_64/primary_db | 6.1 MB 00:01 extras/7/x86_64 | 2.9 kB 00:00 extras/7/x86_64/primary_db | 253 kB 00:00 updates/7/x86_64 | 2.9 kB 00:00 updates/7/x86_64/primary_db | 27 MB 00:08 源标识 源名称 状态 addons/7/x86_64 CentOS-7 - Addons - 163.com 0 base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,072 extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 526 updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 6,173 repolist: 16,771
06-02
<think>好的,用户现在遇到了输入curl -I http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml返回404的问题。我需要先理解这个错误的原因,然后给出解决方案。 首先,用户之前询问过关于“Cannot find a valid baseurl for repo: base/7/x86_64”的错误,我之前给出的解决方案包括检查网络、更换镜像源等。现在用户执行了curl命令,结果返回404,这意味着访问的URL不存在。 CentOS 7在2024年6月30日已经结束生命周期(EOL),官方镜像源可能已经移除了相关资源,所以用户访问的路径可能不存在了。需要确认这一点。此外,用户可能没有更新镜像源到vault.centos.org或者其他归档站点,导致访问旧的URL返回404。 接下来要考虑用户的身份和使用场景。用户可能是在维护一个旧的CentOS 7系统,需要安装或更新软件包,但由于EOL,原有的镜像源不可用。用户可能不太了解CentOS 7已经停止支持,所以需要解释清楚,并建议升级系统,或者更换到可用的镜像源。 用户的需求是解决404错误,能够正常使用yum。深层需求可能是保持系统的正常运行,可能需要安装软件或安全更新。但由于CentOS 7已经EOL,官方不再提供更新,所以需要引导用户使用归档镜像或者考虑系统升级。 解决方案方面,首先需要更换镜像源到vault.centos.org或者阿里云、清华的镜像。同时,用户可能需要修改repo文件中的baseurl,禁用mirrorlist,并启用baseurl。此外,可能还需要清理yum缓存,重新生成元数据。 另外,需要考虑用户是否在企业内网,可能需要配置本地镜像源,或者使用离线的包。如果用户无法升级系统,可能需要长期支持的替代方案,比如AlmaLinux或Rocky Linux。 需要详细列出步骤,确保用户能够一步步操作,例如备份原有repo文件,修改配置,清理缓存,测试验证。同时提醒用户升级系统的重要性,以避免安全风险。 最后,需要验证解决方案是否有效,比如再次运行curl命令检查是否返回200,或者使用yum list确认仓库可用。如果用户的问题仍然存在,可能需要进一步排查网络问题,或者配置文件是否正确。</think>--- ### 🔍 故障原因解析 当执行 `curl -I http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml` 返回 **404 Not Found** 时,说明存在以下情况之一: 1. **CentOS 7 生命周期终止 (EOL)** - 官方镜像已于 **2024-06-30** 停止维护,原路径 `/centos/7/` 已被移除 - 当前访问的是**已失效的URL路径**,官方已将资源迁移到归档站点 2. **镜像源结构调整** - CentOS 项目转向 Stream 模式后,传统版本仓库路径发生变化 - 历史版本仓库统一迁移到 `vault.centos.org` 域名下 --- ### 🛠️ 完整解决方案 #### 第一步:切换归档镜像源 ```bash # 备份原配置文件 sudo cp -r /etc/yum.repos.d /etc/yum.repos.d.bak # 修改所有仓库配置(替换域名+路径) sudo sed -i \ -e 's|^mirrorlist=|#mirrorlist=|g' \ -e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=http://vault.centos.org/centos|g' \ /etc/yum.repos.d/CentOS-*.repo ``` #### 第二步:指定精确版本路径 ```bash # 查询系统精确版本号 cat /etc/redhat-release # 输出示例:CentOS Linux release 7.9.2009 (Core) # 手动修改Base仓库配置 sudo vi /etc/yum.repos.d/CentOS-Base.repo ``` ```ini [base] name=CentOS-7 - Base baseurl=http://vault.centos.org/centos/7.9.2009/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 ``` #### 第三步:强制刷新仓库缓存 ```bash # 清理旧缓存并重建元数据 sudo yum clean all sudo rm -rf /var/cache/yum sudo yum makecache ``` --- ### 🌐 国内镜像源替代方案 #### 阿里云镜像配置 ```bash sudo sed -i \ -e 's|^mirrorlist=|#mirrorlist=|g' \ -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.aliyun.com/centos-vault|g' \ /etc/yum.repos.d/CentOS-*.repo ``` #### 清华镜像配置 ```bash sudo sed -i \ -e 's|^mirrorlist=|#mirrorlist=|g' \ -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault|g' \ /etc/yum.repos.d/CentOS-*.repo ``` --- ### ⚠️ 关键注意事项 1. **版本精确匹配原则** ```bash # 查看所有可用历史版本 curl https://vault.centos.org/ | grep '7.' | awk -F'"' '{print $2}' ``` - 必须使用与系统完全一致的次版本号(如 7.9.2009) 2. **GPG密钥验证** ```bash # 如果出现GPG错误时执行 sudo rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7 ``` --- ### 🔄 替代解决方案 #### 方案一:迁移到兼容系统 ```bash # 迁移到AlmaLinux(兼容RHEL/CentOS) sudo curl -o /etc/yum.repos.d/almalinux.repo https://repo.almalinux.org/alma/almalinux.repo sudo sed -i 's/$releasever/7/g' /etc/yum.repos.d/almalinux.repo ``` #### 方案二:本地ISO镜像挂载 ```bash # 挂载CentOS 7 ISO镜像 sudo mount -o loop CentOS-7-x86_64-DVD-2009.iso /mnt # 创建本地仓库配置 cat <<EOF | sudo tee /etc/yum.repos.d/local.repo [local-base] name=Local CentOS 7 baseurl=file:///mnt enabled=1 gpgcheck=0 EOF ``` --- ### 📊 验证操作有效性 ```bash # 检查新配置的URL可达性(应返回HTTP 200) curl -I http://vault.centos.org/centos/7.9.2009/os/x86_64/repodata/repomd.xml # 测试仓库元数据加载 sudo yum repolist ``` --- ### 📌 长期建议 1. **系统升级计划** - 建议迁移至 **CentOS Stream 8/9** 或 **RHEL 8/9** 等受支持版本 - 或选择 **AlmaLinux/Rocky Linux** 等替代发行版 2. **安全更新策略** - 对于必须保留的CentOS 7系统: ```bash # 添加扩展更新支持(EUS)源 sudo yum install centos-release-eus sudo yum-config-manager --enable eus ``` --- **注**:所有涉及`vault.centos.org`的操作需确认网络能访问境外服务器,如遇连接问题建议使用国内镜像源替代。生产环境强烈建议制定系统升级路线图。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值