How to Enable EPEL Repository on CentOS for Yum Package Management

by Ramesh Natarajan on June 1, 2012

Question: How do I enable EPEL repository on CentOS so that I can install additional packages directly using yum command?

Answer: EPEL stands for Extra Packages for Enterprise Linux.

EPEL is maintained as part of the Fedora project that maintains several packages that are not part of the standard Red Hat Enterprise Linux (or CentOS).

For example, if you are installing nagios (or bugzilla, or any other standard open source software), you’ll typically install it from source. i.e You’ll download the source code from the corresponding open source project site, and compile it on your system. You won’t be able to install those using the standard yum repositories (i.e base, updates, etc.).

If you enable EPEL, you can install nagios, or bugzilla, or any other standard open source software just using yum command.

The following yum command displays all the repositories available on your system. As you see below, it has three CentOS-6 repositories (base, extras and updates). This doesn’t have EPEL enabled yet.

# yum repolist
repo id          repo name                   status
base             CentOS-6 - Base             6,294
extras           CentOS-6 - Extras               4
updates          CentOS-6 - Updates            830
repolist: 7,128

Enable EPEL

First, you need to enable EPEL repository on your system. You don’t need to configure this repository manually in your yum. Instead, download the following package and install it, which will enable the EPEL repository on your system.

On my CentOS 6 system, I did the following. If you just do a “–test”, to test the installation, this will give NOKEY found warning message.

# rpm -ivh epel-release-6-5.noarch.rpm --test
warning: epel-release-6-5.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]

You should download the GPG key for EPEL repository from fedoraproject and install it on your system as shown below. For CentOS 6, go to fedoraprojecthttps://fedoraproject.org/keys, and scroll down to RPM-GPG-KEY-EPEL-6 and download it (or) use the direct wget as shown below.

cd
wget https://fedoraproject.org/static/0608B895.txt
mv 0608B895.txt /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

Verify that the key got installed successfully.

# rpm -qa gpg*
gpg-pubkey-0608b895-4bd22942

Now install the epel-release-6-6.noarch package, which will enable EPEL repository on your system.

# rpm -ivh epel-release-6-5.noarch.rpm
Preparing...                ########################################### [100%]
   1:epel-release-6-5.noarch########################################### [100%]

GPG Key ID

As you see from the above rpm command, it says “key ID 0608b895: NOKEY”. This indicates that this is looking for the GPG key with id 0608b895.

When you downloaded the key from fedoraproject, notice that the GPG key is stored in a filename that is just the keyid. As you see from above, we downloaded 0608B895.txt from fedoraproject website.

Once you’ve installed the key, if you do “rpm -qa gpg*”, you’ll see that the gpg key with the keyid 0608b895 is installed.

The key id 0608b895 is part of the gpg package name as shown below.

# rpm -qa gpg*
gpg-pubkey-0608b895-4bd22942

Verify EPEL

Verify that the EPEL repository is enabled as shown below. Now, you’ll see epel repository (apart from the standard base, updates and extras repositories).

# yum repolist
repo id       repo name                                             status
base          CentOS-6 - Base                                       6,294
epel          Extra Packages for Enterprise Linux 6 - x86_64        7,345
extras        CentOS-6 - Extras                                         4
updates       CentOS-6 - Updates                                      928
repolist: 14,571

Finally, you should be able to install lot of standard open source software (For example, nagios, bugzilla, etc.) directly using yum. Now if you do ‘yum info nagios’, it will show the following information. Check the line that starts with “Repo”, which has the value of “epel”, which indicates that this package is from epel repository.

# yum info nagios
Available Packages
Name        : nagios
Arch        : x86_64
Version     : 3.3.1
Release     : 3.el6
Size        : 1.1 M
Repo        : epel
Summary     : Nagios monitors hosts and services and yells if somethings breaks

Linux Sysadmin Course Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.
Get the Linux Sysadmin Course Now!

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

{ 18 comments… read them below or add one }

1 Jalal Hajigholamali June 1, 2012 at 3:54 am

Hi,
Nice article, thanks a lot..

2 Sandeep krishnan June 1, 2012 at 5:58 am

Thnx for info :-) ..the is a typo error (bugilla )

3 Felix June 1, 2012 at 3:08 pm

The article makes it more complex than was my experience. I installed epel-release (I don’t know if it makes any difference, but since my system is 64-bit, I opted for 64-bit package http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm ). You don’t need to download it (although it may be easier in some cases) – rpm works with http-based URLs.

That was it. The first time I installed a package from epel, it gave me a warning that key is not installed, and offering to install it. After I pressed Y, I didn’t have to do anything else.

So, it’s a nice article, but don’t get scared reading it! It’s not that bad, and there are many packages in epel that you just won’t be able to live without :)

4 Ramesh Natarajan June 1, 2012 at 6:59 pm

@Sandeep,

Thanks for pointing out the typo. It is fixed now.

5 Ranvijay Kumar June 9, 2012 at 1:57 pm

Dear Ramesh,

I am new in Linux, its really great help :-)

6 Jagdish June 26, 2012 at 4:58 am

Cent OS – NVM, Don’t bother to include libmcrypt in new upgrades too..

Handy step by step guide is here to hook EPEL repos.

U rocks Ramesh !

7 zivag July 3, 2012 at 2:02 pm

Ramesh, thanks a bundle, for this article and other very helpful info on your space.

8 Derek October 12, 2012 at 12:09 pm

Thanks! This was a big help.

FYI:
For anyone who is behind a content filter (like I am) which doesn’t allow HTTPS, you need to change HTTPS to HTTP in this file:

/etc/yum.repos.d/epel.repo

9 Michael October 17, 2012 at 9:41 am

Thanks for the info, saved my bacon :)

10 Great March 15, 2013 at 1:18 am

Good lord, it took me 4 hours to figure out how to install yumex with yum. Only thanks to your article, otherwise I’d be LOST. With your article, I had yumex installed in about 5 mins.

I couldn’t find by default most of the programs I like to use in Linux without the EPEL repository (yumex being just one of them).

Thanks !!!!!!!

11 Jeremy S. April 23, 2013 at 8:25 am

Thank you for your article. very helpful!

12 Shan May 8, 2013 at 12:48 pm

I was trying to install Node.js on CentOS 6.
Could NOT have done it without the great instruction provided in this article.
Thanks very much Ramesh!!!

13 uid0 September 15, 2013 at 12:21 pm

Hello,

i have one questions. when i install epel and i upate my system to newer version of centos, will get epel automaticlly updated when i ran yum update, or must i do this by hand?

thanks!

14 Loganathan October 11, 2013 at 2:37 am

Hi Mr Ramesh,

I would want to know if i can make something like a global yum repository for my organization wherein i just have one .repo file pointing to that server(Nat’ed from my datacenter).

This global yum server of my organization would then have all the pointers to all the mirrors of epel’s and others too.

So clients need not download any files externally, but rely on the global yum server to get it and be ready and release it when client requests.

So basically the clients either local or in remote (geographically distant location ) can they access this yum.

Its more like a Windows WSUS server concept.

Please help.

15 sidharth October 14, 2013 at 6:07 pm

Hi, How safe is it to install EPEL repository for RHEL 5.9? is there a way to ensure the packages are not compromised before we do the install?

16 satyajit das December 14, 2013 at 6:10 am

Thanks, sir you are the best!!!!!!!!!!!!!!!!!!!Any time I have any problems the solution is on your website…………………………..

17 Sunil December 31, 2013 at 6:43 am

Thanks, nice one ..my problem got resolved

18 Anower December 5, 2014 at 12:34 am

Step by step i follow your rules. but this errr message show . pls help me.. My Linux RHEL6.1
Error: Cannot retrieve repository metadata (repomd.xml) for repository: epel. Please verify its path and try again

Leave a Comment

Previous post:

Next post: