mirror-web/help/_posts/1970-01-01-epel.md
Miao Wang 96c01f1658
Re-locate files
Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
2020-08-06 15:18:27 +08:00

2.3 KiB
Raw Blame History

layout category mirrorid
help help epel

EPEL 镜像使用帮助

EPEL(Extra Packages for Enterprise Linux)是由Fedora Special Interest Group维护的Enterprise LinuxRHEL、CentOS中经 常用到的包。

下面以CentOS 7为例讲解如何使用tuna的epel镜像。

首先从CentOS Extras这个源[tuna](https://{{ site.hostname }}/help/centos)也有镜像里安装epel-release

yum install epel-release

当前tuna已经在epel的官方镜像列表里所以不需要其他配置mirrorlist机制就能让你的服务器就近使用tuna的镜像。如果你想强制 你的服务器使用tuna的镜像可以修改/etc/yum.repos.d/epel.repo,将mirrorlistmetalink开头的行注释掉。

接下来,取消注释这个文件里baseurl开头的行,并将其中的http://download.fedoraproject.org/pub替换成https://{{ site.hostname }}

可以用如下命令自动替换:(来自 https://github.com/tuna/issues/issues/687

sed -e 's!^metalink=!#metalink=!g' \
    -e 's!^#baseurl=!baseurl=!g' \
    -e 's!//download\.fedoraproject\.org/pub!//{{ site.hostname }}!g' \
    -e 's!http://mirrors\.tuna!https://mirrors.tuna!g' \
    -i /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel-testing.repo

修改结果如下:(仅供参考,不同版本可能不同)

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=https://{{ site.hostname }}/epel/7/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=https://{{ site.hostname }}/epel/7/$basearch/debug
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=https://{{ site.hostname }}/epel/7/SRPMS
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

运行 yum update 测试一下吧。