在 RHEL9 上,我创建了一个本地 YUM Repo,我复制了 /RHEL9-REPO 下的所有文件。
/etc/yum.repos.d/rhel-lcoal.repo 的内容
[rhel-baseos]
name= RHEL 9.0 Local BaseOS YUM REPO
baseurl= file:///RHEL9-REPO/BaseOS
enabled=1
gpgcheck=0
[rhel-AppStream]
name= RHEL 9.0 Local AppStream YUM REPO
baseurl= file:///RHEL9-REPO/AppStream
enabled=1
gpgcheck=0
当我运行“dnf clean all”和“dnf repolist -v”时,出现此错误
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, kpatch, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
DNF version: 4.10.0
cachedir: /var/cache/dnf
RHEL 9.0 Local BaseOS YUM REPO 94 MB/s | 1.7 MB 00:00
Errors during downloading metadata for repository 'rhel-baseos':
- Downloading successful, but checksum doesn't match. Calculated: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855(sha256) Expected: 951a2367c42d5c3fb70e6d8ad430d120cc32e639b361139eaf68d8d2c6569003(sha256)
Error: Failed to download metadata for repo 'rhel-baseos': Yum repo downloading error: Downloading error(s): repodata/951a2367c42d5c3fb70e6d8ad430d120cc32e639b361139eaf68d8d2c6569003-productid.gz - Cannot download, all mirrors were already tried without success
答案1
您必须为本地存储库手动创建元数据才能消除此错误。您可以执行以下操作:
createrepo -v /RHEL9-REPO/BaseOS/
createrepo -v RHEL9-REPO/AppStream
该命令可能需要几分钟的时间来执行,具体取决于您的计算机和 RPM 软件包的数量。
dnf clean all
dnf repolist -v
这将解决您的问题。