【问题标题】:Configuring yum repo to install packages only from my company internal network配置 yum repo 以仅从我公司内部网络安装软件包
【发布时间】:2021-09-12 15:33:00
【问题描述】:

我正在尝试在我的 centos7 机器上配置我的 yum 存储库,以仅从我的内部存储库安装软件包。为此,我做了以下更改:

  1. 将所有当前的 repo 配置移动到不同的位置:

    sudo mv /etc/yum.repos.d/*.repo ~/backup_yum_repos/

  2. 在/etc/yum.repos.d下新建文件Mycompany-internals.repo

  3. 添加了以下内容:

[Mycompany-internals]
name=Mycompany-internals
baseurl=http://linux-repo.my-company.com/abc-2021q2-sr/CentOS-$releasever-$basearch/RPMS.all/
baseurl=http://linux-repo.my-company.com/epel/abc-2021q2-sr/epel/epel
baseurl=http://linux-repo.my-company.com/epel/abc-2021q2-sr/epel/epel-debuginfo/
baseurl=http://linux-repo.my-company.com/epel/abc-2021q2-sr/epel/epel-source/
baseurl=https://linux-repo.my-company.com/utilities/avamar/CentOS$releasever/
baseurl=https://linux-repo.my-company.com/utilities/splunk/v8/
baseurl=http://linux-repo.my-company.com/utilities/perforce/perforce
baseurl=http://linux-repo.my-company.com/utilities/docker/docker/
enabled=1
gpgcheck=0


现在,我希望正常的 yum 安装可以使用我上面提到的注册表工作。

但是当我运行yum install docker(例如)时,它失败并出现错误:

Loaded plugins: changelog, fastestmirror, langpacks, priorities
Loading mirror speeds from cached hostfile
My-company-internal                                                                                                              | 2.5 kB  00:00:00     
My-Company-internal/primary_db                                                                                                   |  42 kB  00:00:00     
No package docker available.
Error: Nothing to do

【问题讨论】:

  • 您是否设置了卫星或太空行走服务器?
  • linux-repo.my-company.com* 这些是我可以用来安装软件包的现有存储库。我对此没有更多的想法

标签: linux centos repository yum


【解决方案1】:

您多次使用 baseurl= 语句,这很糟糕,下面是 yum.conf 手册页的引用:

              baseurl Must be a URL to the directory where the yum repository's `repodata' directory lives. Can be an http://, ftp://  or
              file:// URL. You can specify multiple URLs in one baseurl statement. The best way to do this is like this:
              [repositoryid]
              name=Some name for this repository
              baseurl=url://server1/path/to/repository/
                      url://server2/path/to/repository/
                      url://server3/path/to/repository/

              If  you  list  more than one baseurl= statement in a repository you will find yum will ignore the earlier ones and probably
              act bizarrely. Don't do this, you've been warned.

【讨论】:

    【解决方案2】:

    你的 yum 是哪个版本的?,有一个错误,yum 会识别第一个 URL 而忽略其余的,这已在 yum-3.4.3-159.el7 版本中修复。

    【讨论】:

    • 我使用的是 3.4.3。
    • 这个命令的输出是什么?, rpm -qa yum
    • yum-3.4.3-163.el7.centos.noarch
    • 我对这个 yum 和系统管理员世界很陌生。所以我怀疑自己一定缺少一些基本的东西或配置。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-08
    • 1970-01-01
    • 1970-01-01
    • 2011-02-28
    • 2016-08-13
    • 2011-06-04
    相关资源
    最近更新 更多