如何从多个 YUM 存储库安装包?

如何从多个 YUM 存储库安装包?

我正在尝试在我的服务器中配置 2 个 yum 存储库(RHEL 7.0 和 RHEL 7.2)。我已完成创建他们的 .repo 文件。请参阅下面的输出:

[root@foundation ~]# yum repolist all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id                                                 repo name                                                                         status
InstallMedia                                            Red Hat Enterprise Linux 7.2                                                      disabled
google-chrome                                           google-chrome                                                                     enabled:     3
rhel_7_0                                                RHEL 7.0 repository (foundation server)                                           enabled: 4,305
rhel_7_2                                                RHEL 7.2 repository (foundation server)                                           enabled: 4,620
repolist: 8,928
[root@foundation ~]# 

当我尝试列出内核软件包时,它仅显示 RHEL 7.2 中可用的软件包

[root@foundation ~]# yum list *kernel*
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed Packages
abrt-addon-kerneloops.x86_64                                         2.1.11-34.el7                                                      @anaconda/7.2   
kernel.x86_64                                                        3.10.0-327.el7                                                     @anaconda/7.2   
kernel-headers.x86_64                                                3.10.0-327.el7                                                     @foundation-repo
kernel-tools.x86_64                                                  3.10.0-327.el7                                                     @anaconda/7.2   
kernel-tools-libs.x86_64                                             3.10.0-327.el7                                                     @anaconda/7.2   
Available Packages
kernel-abi-whitelists.noarch                                         3.10.0-327.el7                                                     rhel_7_2        
kernel-debug.x86_64                                                  3.10.0-327.el7                                                     rhel_7_2        
kernel-debug-devel.x86_64                                            3.10.0-327.el7                                                     rhel_7_2        
kernel-devel.x86_64                                                  3.10.0-327.el7                                                     rhel_7_2        
kernel-doc.noarch                                                    3.10.0-327.el7                                                     rhel_7_2        
texlive-l3kernel.noarch                                              2:svn29409.SVN_4469-38.el7                                         rhel_7_2        
[root@foundation ~]# 

如何才能看到 RHEL 7.0 中的内核软件包?我希望能够安装它。我怎样才能强制 yum 在我想要的存储库上安装包?例如,我将从 RHEL 7.0 存储库安装它,而不是从 RHEL 7.2 存储库安装。

答案1

根据上面的人(Rahul 和 Julie Pelletier)收集的输入,我能够通过禁用您不想包含的存储库(在我的例子中是 rhel_7_0 存储库)来从特定存储库安装内核包。

yum --disablerepo rhel_7_0 install -y kernel

然后我就可以在 RHEL 7.0 机器中从 rhel_7_2 存储库安装内核并成功启动。

[root@desktop2 ~]# yum list kernel
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed Packages
kernel.x86_64                                              3.10.0-123.el7                                              @anaconda/7.0
kernel.x86_64                                              3.10.0-327.el7                                              @rhel_7_2    
[root@desktop2 ~]# grubby --default-kernel
/boot/vmlinuz-3.10.0-327.el7.x86_64
[root@desktop2 ~]# uname -r
3.10.0-327.el7.x86_64
[root@desktop2 ~]# 

相关内容