出现问题
[root@master1 ~]# yum update
无法找到发布版本(可用 ‘–releasever’ 指定版本)
Rocky Linux $releasever - AppStream 6.6 kB/s | 2.3 kB 00:00
Errors during downloading metadata for repository ‘appstream’:
- Status code: 404 for https://mirrors.aliyun.com/rockylinux/$releasever/AppStream/x86_64/os/repodata/repomd.xml (IP: 125.64.132.20)
错误:为仓库 ‘appstream’ 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
问题分析
yum无法建立元数据,显示releasever不可用。repo源域名中:https://mirrors.aliyun.com/rockylinux/$releasever/AppStream/x86_64/os/repodata/repomd.xml
,$releasever没有被正常识别为对应的rocky版本号。
检查本机rocky-release没有被安装
[root@master1 ~]# rpm -qi rocky-release
未安装软件包 rocky-release
解决
修改本机repo源中的$releaserver为对应的rocky版本号,在进行更新
[root@master1 ~]# sed -i 's/$releasever/8/g' /etc/yum.repos.d/*.repo
[root@master1 ~]# yum install -y rocky-release
[root@master1 ~]# yum update
此时参看rocky-release包状态正常:
[root@master1 ~]# rpm -q rocky-release
rocky-release-8.6-4.el8.noarch
[root@master1 ~]# rpm -qi rocky-release
Name : rocky-release
Version : 8.6
Release : 4.el8
Architecture: noarch
Install Date: 2022年10月19日 星期三 18时38分49秒
Group : Unspecified
Size : 18508
License : BSD-3-Clause
Signature : RSA/SHA256, 2022年08月30日 星期二 17时13分25秒, Key ID 15af5dac6d745a60
Source RPM : rocky-release-8.6-4.el8.src.rpm
Build Date : 2022年08月30日 星期二 17时06分47秒
Build Host : ord1-prod-x86build002.svc.aws.rockylinux.org
Relocations : (not relocatable)
Packager : infrastructure@rockylinux.org
Vendor : Rocky
URL : https://rockylinux.org
Summary : Rocky Linux release files
Description :
Rocky Linux release files.
将repo源修改回$releaserver验证
[root@master1 ~]# sed -i 's/8/$releasever/g' /etc/yum.repos.d/Rocky*.repo
[root@master1 ~]# yum makecache
Rocky Linux 8 - AppStream 50 kB/s | 4.8 kB 00:00
Rocky Linux 8 - BaseOS 61 kB/s | 4.3 kB 00:00
Rocky Linux 8 - Extras 51 kB/s | 3.5 kB 00:00
Docker CE Stable - x86_64 37 kB/s | 3.5 kB 00:00
ELRepo.org Community Enterprise Linux Repository - el8 2.4 kB/s | 3.0 kB 00:01
Kubernetes 3.7 kB/s | 844 B 00:00
元数据缓存已建立。