2.7. 使用输入文件添加新红帽内容存储库


在 Red Hat Update Infrastructure 4.2 及更高版本中,您可以使用配置的 YAML 输入文件添加自定义存储库。您可以在 /usr/share/rhui-tools/examples/repo_add_by_file.yaml 目录中找到 RHUA 节点上的 YAML 文件示例模板。

这个功能只在命令行界面(CLI)中可用。

先决条件

  • 确保您有访问 RHUA 节点的 root 访问权限。

流程

  1. 在 RHUA 节点上,创建一个以下格式的 YAML 输入文件:

    # cat /root/example.yaml
    name: Example_YAML_File
    repo_ids:
        - rhel-8-for-x86_64-baseos-eus-rhui-rpms-8.1
        - rhel-8-for-x86_64-baseos-eus-rhui-rpms-8.2
        - rhel-8-for-x86_64-baseos-eus-rhui-rpms-8.4
        - rhel-8-for-x86_64-baseos-eus-rhui-rpms-8.6
    Copy to Clipboard Toggle word wrap
  2. 使用 rhui-manager 工具添加输入文件中列出的存储库:

    # rhui-manager repo add_by_file --file /root/example.yaml --sync_now
    The name of the repos being added: Example_YAML_File
    Loading latest entitled products from Red Hat...
    ... listings loaded
    Successfully added Red Hat Enterprise Linux 8 for x86_64 - BaseOS - Extended Update Support from RHUI (RPMs) (8.1) (Yum)
    Successfully added Red Hat Enterprise Linux 8 for x86_64 - BaseOS - Extended Update Support from RHUI (RPMs) (8.2) (Yum)
    Successfully added Red Hat Enterprise Linux 8 for x86_64 - BaseOS - Extended Update Support from RHUI (RPMs) (8.4) (Yum)
    Successfully added Red Hat Enterprise Linux 8 for x86_64 - BaseOS - Extended Update Support from RHUI (RPMs) (8.6) (Yum)
    ... successfully scheduled for the next available timeslot.
    ... successfully scheduled for the next available timeslot.
    ... successfully scheduled for the next available timeslot.
    ... successfully scheduled for the next available timeslot.
    Copy to Clipboard Toggle word wrap

验证

  • 在 CLI 中,使用以下命令列出所有已安装的软件仓库,并检查是否已安装了正确的软件仓库:

    # rhui-manager repo list
    Copy to Clipboard Toggle word wrap
  • 在 RHUI Management Tool 中,在 Repository Management 屏幕中,按 l 列出所有已安装的存储库,并检查是否已安装了正确的存储库。
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部