我的 CentOS 8.1.1911 中有两个 rpm repos。详细信息如下:
# virt-1.repo
[appstream]
name=CentOS Linux 8-stream - AppStream
baseurl=http://mirrors.ustc.edu.cn/centos/8-stream/AppStream/$basearch/os/
gpgcheck=0
enabled=1
# virt-2.repo
[centos-advanced-virtualization]
name=CentOS Linux 8-stream - Advanced Virtualization
baseurl=http://mirrors.ustc.edu.cn/centos/8-stream/virt/$basearch/advancedvirt-common/
gpgcheck=0
enabled=1
两个仓库中都有这个包libvirt
,而且仓库中有更新的包centos-advanced-virtualization
,我的操作如下:
yum clean all && yum makecache
yum list libvirt --showduplicates
,但我从appstream
# yum list libvirt --showduplicates
Last metadata expiration check: 0:00:18 ago on Sun 26 Sep 2021 05:22:42 PM CST.
Available Packages
libvirt.x86_64 6.0.0-35.module_el8.5.0+746+bbd5d70c appstream
libvirt.x86_64 6.0.0-36.module_el8.5.0+821+97472045 appstream
- 删除应用程序流,
mv virt-1.repo virt-1.repo.bak && yum makecache
yum list libvirt --showduplicates
,我可以从centos-advanced-virtualization
# yum list libvirt --showduplicates
Last metadata expiration check: 0:00:30 ago on Sun 26 Sep 2021 05:26:08 PM CST.
Available Packages
libvirt.x86_64 7.0.0-9.el8s centos-advanced-virtualization
libvirt.x86_64 7.0.0-13.el8s centos-advanced-virtualization
libvirt.x86_64 7.0.0-14.el8s centos-advanced-virtualization
libvirt.x86_64 7.4.0-1.el8s centos-advanced-virtualization
libvirt.x86_64 7.5.0-1.el8s centos-advanced-virtualization
libvirt.x86_64 7.6.0-2.el8s centos-advanced-virtualization
那么,为什么一开始我就无法获得较新的版本?我是不是错过了什么?
答案1
我解决了这个问题这里:
DNF 希望从 AppStream 安装 MariaDB 的主要原因是它偏爱模块化软件包。这意味着,如果特定软件包(名称)或虚拟提供是模块的一部分,并且其他存储库中有同名的软件包,并且它们不是模块的一部分,那么 DNF 将始终希望从模块化存储库安装软件包。
所以,这就是我无法获取最新版本libvirt
软件包的原因。按照如下方式更新后virt-2.repo
,一切正常:
# virt-2.repo
[centos-advanced-virtualization]
name=CentOS Linux 8-stream - Advanced Virtualization
baseurl=http://mirrors.ustc.edu.cn/centos/8-stream/virt/$basearch/advancedvirt-common/
gpgcheck=0
enabled=1
module_hotfixes=1
我可以获得最新版本libvirt
:
# yum list libvirt --showduplicates
Last metadata expiration check: 0:45:51 ago on Mon 27 Sep 2021 06:53:12 PM CST.
Available Packages
libvirt.x86_64 6.0.0-35.module_el8.5.0+746+bbd5d70c appstream
libvirt.x86_64 6.0.0-36.module_el8.5.0+821+97472045 appstream
libvirt.x86_64 7.0.0-9.el8s Virtualization
libvirt.x86_64 7.0.0-13.el8s Virtualization
libvirt.x86_64 7.0.0-14.el8s Virtualization
libvirt.x86_64 7.4.0-1.el8s Virtualization
libvirt.x86_64 7.5.0-1.el8s Virtualization
libvirt.x86_64 7.6.0-2.el8s Virtualization