答案1
使用详细标志 ( --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)
如果你只想获取 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
或者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
答案2
您可以从 /etc/yum.repo.d/* 文件中 grep yum 使用的 URL。
同时,yum 将下载 URL 列表并尝试使用最快的 URL 进行下载。这些列表可能会/将会发生变化,因此您必须配置要使用的 URL。