EPEL (Extra Packages for Enterprise Linux) 由 Fedora 專案維護,為 RHEL/CentOS 提供超過 1 萬個額外套件 (如 htop, nginx, python3, nodejs 等),且**不替換基礎系統套件**。本文說明 CentOS 5/6/7 透過 RPM 直裝 EPEL 的標準流程與多源衝突避坑指南。

https://fedoraproject.org/wiki/EPEL| 源組合 | 風險 | 建議 |
|---|---|---|
| EPEL + RPMForge (RepoForge) | **高度衝突**,大量重複套件版本不同 | 二選一,推薦保留 EPEL |
| EPEL + RPM Fusion | 多媒體編碼器衝突 | 僅在需要專有編碼時啟用 RPM Fusion |
| EPEL + Remi | PHP/MySQL 版本衝突 | Remi 設定 priority 或 includepkgs 限制範圍 |
| EPEL + 官方 Base/Updates | **無衝突** (設計目標) | 安全組合 |
**最佳實踐**:生產環境**僅啟用 EPEL 一個第三方源**,特殊需求再謹慎添加並設定 priority (需安裝 yum-plugin-priorities)。
cat /etc/redhat-release
# CentOS release 6.4 (Final)
# CentOS Linux release 7.2.1511 (Core)
官方下載頁:
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmhttps://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpmhttps://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm**通用安裝包** (自動偵測版本,noarch 適用 32/64 位):
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E %rhel).noarch.rpm
sudo rpm -ivh epel-release-latest-*.noarch.rpm
# 或
sudo yum localinstall epel-release-latest-*.noarch.rpm
yum repolist
# 輸出應包含:
# epel Extra Packages for Enterprise Linux 7 - x86_64 12,000+
設定檔自動部署至 /etc/yum.repos.d/epel.repo 及 epel-testing.repo (預設停用)。
sudo yum install htop -y
# htop 為 EPEL 獨有,Base 源無此套件
htop # 啟動互動式程序監控
vim /etc/yum.repos.d/epel.repo
# [epel]
# enabled=1 # 啟用主源
# [epel-testing]
# enabled=0 # 測試源保持停用
# [epel-debuginfo]
# enabled=0 # 除錯符號源停用
# 如需鎖定特定鏡像 (避免 metalink 選到慢速節點):
# baseurl=https://mirrors.aliyun.com/epel/7/$basearch/
# 注釋掉 metalink 行
dnf install epel-release (內建於 BaseOS/AppStream)dnf config-manager --set-enabled epel-modularEPEL 讓 CentOS 瞬間擁有接近 Fedora 的豐富套件生態,是企業級 Linux 必裝的第一個第三方源。