How to Add the EPEL Repository in RHEL/CentOS 5/6

EPEL (Extra Packages for Enterprise Linux) is a third party RPM repository for Red Hat Enterprise Linux and CentOS. This article describes how to add the EPEL repository in Red Hat Enterprise Linux and CentOS 5 or 6.
Install EPEL1. Install the EPEL package using the command below.

rpm -Uvh http://bit.ly/q7kHBq

NoteThe full link for the RHEL 6 EPEL package and the links for the lower versions of RHEL are provided below. The rpm command prior to RHEL 6 cannot handle http redirects so no bit.ly links have been provided.

http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm

http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

http://download.fedora.redhat.com/pub/epel/4/i386/epel-release-4-10.noarch.rpm

yum repolist2. Verify the installation using the command below. You should see epel in the output.

yum repolist

install yum priorities3. Install the Yum priorities package using the command below.

yum install yum-priorities

edit epel.repo4. Edit the file /etc/yum.repos.d/epel.repo and add the line below under the [epel] section.

priority=10

yum check update5. Test your configuration using the command below. You should see a priority protections message in the output.

yum check-update