【问题标题】:yum + how to enable repo in yum when enabled=0 [closed]yum + 当启用=0时如何在yum中启用repo [关闭]
【发布时间】:2021-02-28 23:29:13
【问题描述】:

我们的 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 ,而 enabled=0 ??

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

【问题讨论】:

  • 请使用tour 并阅读How to Ask 以了解为什么这里偏离主题。此外,请确保在应用标签之前阅读所应用标签的说明。

标签: linux rpm yum rhel


【解决方案1】:

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

yum-config-manager --enable infra-76

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

【讨论】:

  • 你的意思是? yum --disablerepo=* yum-config-manager --enable infra-76 update -y
  • 没有。一枪,确保存储库可供 yum 使用:yum-config-manager --enable infra-76。这是持久的。然后yum update -y。存储库永远保持启用状态。如果您想禁用单个命令,您可以:yum --disable-repo=infra-76 install some-package.
猜你喜欢
  • 1970-01-01
  • 2020-03-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-10
  • 1970-01-01
相关资源
最近更新 更多