【问题标题】:Why dnf config-manager --save does not work?为什么 dnf config-manager --save 不起作用?
【发布时间】:2020-04-16 14:18:36
【问题描述】:

我想用 dnf config-manager 为我的系统添加一个 rpm 存储库:

# dnf config-manager --add-repo=http://example.com/rpm-repo --setopt=gpgcheck=0 --save
Adding repo from: http://example.com/rpm-repo
# cat /etc/yum.repos.d/example.com_rpm-repo.repo
[example.com_rpm-repo]
name=created by dnf config-manager from http://example.com/rpm-repo
baseurl=http://example.com/rpm-repo
enabled=1

为什么生成的 example.com_rpm-repo.repo 文件不包含指定的选项:gpgcheck=0?

环境:

# cat /etc/centos-release
CentOS Linux release 8.0.1905 (Core)
# yum list installed | grep dnf
dnf.noarch                          4.0.9.2-5.el8                     @System
dnf-data.noarch                     4.0.9.2-5.el8                     @System
dnf-plugins-core.noarch             4.0.2.2-3.el8                     @BaseOS
dnf-utils.noarch                    4.0.2.2-3.el8                     @BaseOS
libdnf.x86_64                       0.22.5-4.el8                      @System
python3-dnf.noarch                  4.0.9.2-5.el8                     @System
python3-dnf-plugins-core.noarch     4.0.2.2-3.el8                     @BaseOS
python3-libdnf.x86_64               0.22.5-4.el8                      @System

【问题讨论】:

    标签: configuration centos rpm package-managers dnf


    【解决方案1】:

    (遗憾地)你不能在一次操作中做到这一点。您首先需要创建存储库,然后设置选项:

    dnf config-manager --add-repo=http://example.com/rpm-repo
    dnf config-manager --save --setopt=gpgcheck=0 example.com_rpm-repo
    

    是的,遗憾的是,这意味着您需要知道 reoid,因此自动化到一个操作中会稍微复杂一些。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-22
      • 2018-06-12
      • 2017-10-18
      • 1970-01-01
      • 2014-05-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多