Cannot get latest-version package from multiple yum repos

Solution 1:

I solved this problem from here:

The major reason why DNF wants to install MariaDB from AppStream is that it has a preference for modular packages. Which means, that if specific packages (names) or virtual provides are part of a module, and there are packages with the same names available from other repositories and they are not part of the module, then DNF will always want to install packages from the modular repository.

So, that's why I can't get the latest-version libvirt package. After updating my virt-2.repo as follows, everything is fine:

# 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

I can get latest-version 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