# EPEL 软件仓库

原文：https://mirrors.zju.edu.cn/docs/epel/
内容语言：zh（中文）
导出选项：默认选项；可在原文页面调整选项后复制全文

- 镜像地址：`https://mirrors.zju.edu.cn/epel`
- sudo：开启

> 本站收录所有共享帮助文档；文档存在不代表浙江大学镜像站当前提供该镜像。请查阅 https://mirrors.zju.edu.cn/mirrorz.json 确认当前目录与状态。
> 下列命令使用上述选项，请根据实际系统版本选择；未填写的文本选项需要在原文页面补充。

## 项目简介

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


## 使用方法

下面以 Rocky Linux 9 为例讲解如何使用本镜像站的 epel 镜像。RHEL 及其他衍生发行版同样可用该方法。

首先从 Extras 里安装 epel-release：

```bash
sudo dnf install epel-release
```

用如下命令自动替换：（修改自 [https://github.com/tuna/issues/issues/687](<https://github.com/tuna/issues/issues/687>)）

```bash
sudo sed -e 's!^metalink=!#metalink=!g' \
    -e 's!^#baseurl=!baseurl=!g' \
    -e 's!https\?://download\.fedoraproject\.org/pub/epel!https://mirrors.zju.edu.cn/epel!g' \
    -e 's!https\?://download\.example/pub/epel!https://mirrors.zju.edu.cn/epel!g' \
    -i /etc/yum.repos.d/epel{,-testing}.repo
```

`epel.repo` 的修改结果如下：（仅供参考，不同版本可能不同）

```ini
[epel]
name=Extra Packages for Enterprise Linux $releasever - $basearch
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
baseurl=https://mirrors.zju.edu.cn/epel/$releasever/Everything/$basearch/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=1
gpgcheck=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever

[epel-debuginfo]
name=Extra Packages for Enterprise Linux $releasever - $basearch - Debug
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
baseurl=https://mirrors.zju.edu.cn/epel/$releasever/Everything/$basearch/debug/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux $releasever - $basearch - Source
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
baseurl=https://mirrors.zju.edu.cn/epel/$releasever/Everything/source/tree/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
gpgcheck=1
```

由于无法同步，镜像站不包含 EPEL Cisco OpenH264 仓库（`epel-cisco-openh264.repo`），如果不需要可手动将其改为 `enabled=0`。

运行 `dnf update` 测试一下吧。

---

来源：[ZJUSCT/mirrorz-docs](https://github.com/ZJUSCT/mirrorz-docs/tree/de87bf043f31d45ef3a951cc6dc11ddb8c85b4f6/epel)
源提交：de87bf043f31d45ef3a951cc6dc11ddb8c85b4f6
许可：[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
文档索引：https://mirrors.zju.edu.cn/llms.txt
