Installing and using the Fedora EPEL yum repository in your CentOS Linux VPS

Installing and using the Fedora EPEL yum repository in your CentOS Linux VPS

This articles discusses the automated way of installing the EPEL repository in CentOS.

Overview

EPEL (Extra Packages for Enterprise Linux) is a Fedora maintained yum repository that maintains a set of additional packages for Enterprise Linux releases like Red Hat Enterprise Linux (RHEL), CentOS and Oracle Linux.
YUM (Yellowdog Updater Modified) is a package management utility used by CentOS, RHEL, Fedora Linux distributions. A YUM repository is a collection of software packages hosted locally or on remote servers. YUM is based on RPM manager and it consists of a set of Python language libraries.

YUM Repository configuration file structure

CentOS Linux yum repository configuration is found under /etcyum.repos.d/:


[root@myvpsie ~]# ls /etc/yum.repos.d/
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Sources.repo  CentOS-Vault.repo

Each repository is defined as a set of parameters in a file with the .repo extension.

Inside each .repo file the following directives define the repository>
[repository-id] (mandatory) This defines the unique ID of the repository.
name (mandatory)The readable name of the repository.
baseurl (mandatory) Defines the channel address that can be either a file, ftp, http or https address.
enabled “1” or “0”. If set to “1”, yum is allowed to use the channel.
gpgcheck Enables or disable GPG signature for the repository.
gpgkey Address of the GPG public key file.

EPEL repository

There is a way to install the EPEL repository in CentOS Linux without constructing the configuration file manually. This is because configuration file is included in in CentOS base yum repository:


[root@myvpsie ~]# yum search epel
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.advancedhosters.com
 * extras: mirror.trouble-free.net
 * updates: mirrors.advancedhosters.com
====================================================================== N/S matched: epel =======================================================================
epel-release.noarch : Extra Packages for Enterprise Linux repository configuration

 

Installing EPEL repository in CentOS


[root@myvpsie ~]# yum install epel-release
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.advancedhosters.com
 * extras: mirror.trouble-free.net
 * updates: mirrors.advancedhosters.com
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================
 Package                                    Arch                                 Version                             Repository                            Size
================================================================================================================================================================
Installing:
 epel-release                               noarch                               7-5                                 extras                                14 k

Transaction Summary
================================================================================================================================================================
Install  1 Package

Total download size: 14 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/extras/packages/epel-release-7-5.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for epel-release-7-5.noarch.rpm is not installed
epel-release-7-5.noarch.rpm                                                                                                              |  14 kB  00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-0.1406.el7.centos.2.3.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-5.noarch                                                                                                                      1/1
  Verifying  : epel-release-7-5.noarch                                                                                                                      1/1

Installed:
  epel-release.noarch 0:7-5

Complete!

 

The output shows there are two prompts requiring human input. First one confirms installing “epel-release” package and the other one confirms installing the GPG key for the epel repository.

Once this is done, EPEL repository header files need to be downloaded to local directories. This is done automatically by YUM next time it is executed:


[root@myvpsie ~]# yum search something
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
epel/x86_64/metalink                                                                                                                     |  14 kB  00:00:00
epel                                                                                                                                     | 4.4 kB  00:00:00
(1/2): epel/x86_64/group_gz                                                                                                              | 250 kB  00:00:00
(2/2): epel/x86_64/primary_db                                                                                                            | 3.9 MB  00:00:03
(1/2): epel/x86_64/updateinfo                                                                                                            | 280 kB  00:00:00
(2/2): epel/x86_64/pkgtags                                                                                                               | 1.3 MB  00:00:02
Loading mirror speeds from cached hostfile
 * base: mirrors.advancedhosters.com
 * epel: mirrors.einstein.yu.edu
 * extras: mirror.trouble-free.net
 * updates: mirrors.advancedhosters.com
==================================================================== N/S matched: something ====================================================================
nagios.x86_64 : Nagios monitors hosts and services and yells if somethings breaks
perl-asa.noarch : Lets your class/object say it works like something else

Verify EPEL repository was installed on the disk

Once it has been installed, it will install a .repo configuration file in /etc/yum.repos.d:


[root@myvpsie ~]# ls -la /etc/yum.repos.d/
total 32
drwxr-xr-x.  2 root root 4096 Feb 12 17:13 .
drwxr-xr-x. 73 root root 4096 Feb 12 16:14 ..
-rw-r--r--.  1 root root 1612 Jul  4  2014 CentOS-Base.repo
-rw-r--r--.  1 root root  640 Jul  4  2014 CentOS-Debuginfo.repo
-rw-r--r--.  1 root root 1331 Jul  4  2014 CentOS-Sources.repo
-rw-r--r--.  1 root root  156 Jul  4  2014 CentOS-Vault.repo
-rw-r--r--.  1 root root 1056 Nov 25 11:23 epel-testing.repo
-rw-r--r--.  1 root root  957 Nov 25 11:23 epel.repo
[root@myvpsie ~]# cat /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/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=http://download.fedoraproject.org/pub/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=http://download.fedoraproject.org/pub/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

As expected, EPEL yum repository is installed, enabled and ready for use.

 

You can actually try those repo steps on our platform in few minutes utilizing our PCS (Private Cloud Solution) which allows you to have VPSie(s) on a private network – NAT – Port forward – traffic control for inbound and outbound – multiple gateway IPs which you could use for the load-balancing and failover.

Related Articles