failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.

异常

yum makecache

failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
http://mirrors.aliyun.com/centos/$releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found

一般而言,出现此异常的原因是变量 $releasever 未找到;

这个变量对应 yum.confdistroverpkg=centos-release 配置,centos-release 从包=centos-releasezhong获取,下面是安装步骤:

# 查看对应包
rpm -qi centos-release
>>> package centos-release is not installed

# 下载包,需要找到对应版本的包
wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/centos-release-7-9.2009.0.el7.centos.x86_64.rpm

# 安装
rpm -Uvh --replacepkgs centos-release-7-9.2009.0.el7.centos.x86_64.rpm 

# 再次查看
rpm -qi centos-release
>>> 
Name        : centos-release
Version     : 7
Release     : 9.2009.0.el7.centos
Architecture: x86_64
Install Date: Tue 14 Feb 2023 11:32:53 AM CST
Group       : System Environment/Base
Size        : 44787
License     : GPLv2
Signature   : RSA/SHA256, Mon 26 Oct 2020 08:40:20 PM CST, Key ID 24c6a8a7f4a80eb5
Source RPM  : centos-release-7-9.2009.0.el7.centos.src.rpm
Build Date  : Fri 23 Oct 2020 10:53:59 PM CST
Build Host  : x86-01.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
Summary     : CentOS Linux release file
Description :
CentOS Linux release files

再次运行 yum clean all && yum makecache 即可

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值