确定 Yum 存储库 URL

Bal*_*ala 10 linux centos yum rpm

如果我在文件夹下添加一个新的存储库文件/etc/yum.repo.d/yum update我怎样才能收集所有将要获取更新的URL 。

我问这个问题是因为我有一台位于防火墙后面的服务器,该服务器仅允许流量流向预先指定的域名。我想确定所有域名,以便将它们全部列入白名单,以便我的服务器保持更新。

在此输入图像描述

han*_*xue 13

使用详细标志 ( --verbose/-v) 与yum repolist -v enabled

$ yum repolist -v enabled
Repo-id      : epel
Repo-name    : Extra Packages for Enterprise Linux 6 - x86_64
Repo-revision: 1565313214
Repo-updated : Thu Aug  8 19:14:15 2019
Repo-pkgs    : 12,559
Repo-size    : 11 G
Repo-metalink: https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=x86_64
  Updated    : Thu Aug  8 19:14:15 2019
Repo-baseurl : https://sjc.edge.kernel.org/fedora-buffet/epel/6/x86_64/ (50
             : more)
Repo-expire  : 21,600 second(s) (last: Sat Aug 10 10:54:19 2019)
Run Code Online (Sandbox Code Playgroud)

如果您只想获取 URL,

$ yum repolist -v enabled | grep Repo-baseurl | cut -d\  -f 3
http://mirror/pe-repos/6.x86_64
http://mirror/uimrepo
https://sjc.edge.kernel.org/fedora-buffet/epel/6/x86_64/
http://mirror/openclrepo
https://puppet.contoso.com:8140/packages/2016.4.11/el-6-x86_64
http://mirror/rhel6.5.extra.x86_64
http://mirror/rhel6.5.x86_64
http://mirror/rhel6.5.patch-current.x86_64
Run Code Online (Sandbox Code Playgroud)

或者grep直接使用 repo 文件

$  grep 'baseurl=' /etc/yum.repos.d/* | cut -d= -f2
http://download.fedoraproject.org/pub/epel/6/$basearch
http://download.fedoraproject.org/pub/epel/6/$basearch/debug
http://download.fedoraproject.org/pub/epel/6/SRPMS
http://download.fedoraproject.org/pub/epel/testing/6/$basearch
http://download.fedoraproject.org/pub/epel/testing/6/$basearch/debug
http://download.fedoraproject.org/pub/epel/testing/6/SRPMS
http://mirror/openclrepo
https://puppet.contose.com:8140/packages/2016.4.11/el-6-x86_64
http://mirror/pe-repos/6.x86_64
ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/
ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/
http://mirror/uimrepo
http://mirror/rhel6.5.x86_64
http://mirror/rhel6.5.extra.x86_64
http://mirror/rhel6.5.patch-current.x86_64
Run Code Online (Sandbox Code Playgroud)


小智 0

您可以从 /etc/yum.repo.d/* 文件中 grep yum 使用的 URL。

同时,yum 将下载 URL 列表并尝试使用最快的 URL 进行下载。这些列表可能会发生变化,因此您必须配置您想要使用的 URL。