首页 > 解决方案 > yum + 当启用=0 时如何在 yum 中启用 repo

问题描述

我们的 rhel 7.2 服务器上有以下 repo

如我们所见,我们将enabled=0, 设置为默认值

more infra-update.repo
[infra-76-update]
name=infra 76 update
baseurl=http://linux_machine/infra-76
gpgcheck=0
enabled=0

但是如果我们想使用这个 repo - infra-7.6,我们编写以下 yum 语法

yum --disablerepo=* --enablerepo=infra-76 update -y

但我们得到

Error getting repository data for infra-76, repository not found

但是当我们设置 时enabled=1,我们可以使用 - ( yum --disablerepo=* --enablerepo=infra-76 update -y)成功安装 yum

但问题是:

是否可以将 repo 启用为yum --disablerepo=* --enablerepo=infra-76, while enabled=0??

注意 - 目标是从 repo 安装 rpm infra-76,尽管 repo config 中的参数是enabled=0

标签: linuxrpmyumrhel

解决方案


您可以使用yum-config-manager(您可能需要安装yum-utils):

yum-config-manager --enable infra-76

标志--disablerepo--enablerepo临时禁用/启用存储库(仅用于该命令,在这种情况下仅用于运行yum update一次)。


推荐阅读