异常
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.conf
的 distroverpkg=centos-release
配置,centos-release
从包=centos-release
zhong获取,下面是安装步骤:
# 查看对应包
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
即可