Blog

03/06/2019

How To Install EPEL Repo on a CentOS and RHEL 7.x



How do I install the extra repositories such as Fedora EPEL repo on a Red Hat Enterprise Linux server version 7.x or CentOS Linux server version 7.x?

[donotprint][/donotprint]You can easily install various packages by configuring a CentOS 7.x or RHEL 7.x system to use Fedora EPEL repos and third party packages. Please note that these packages are not officially supported by either CentOS or Red Hat, but provides many popular packages and apps. This quick tutorial explains how to configure a CentOS or Red Hat Enterprise Linux (RHEL) version 7.x to use the Fedora Extra Packages for Enterprise Linux (EPEL) repository.

Commands to install EPEL repo on a CentOS Linux and RHEL 7.x

The procedure to enable EPEL repository for a CentOS/RHEL 7.x server is as follows:

  1. Open a shell prompt.
  2. Or login to a host called server1 using ssh client.
  3. Install epel using the following command: yum -y install epel-release
  4. Refresh repo by typing the following command: yum repolist

How to install EPEL repo on a CentOS and RHEL 7.x

The following instructions assumes that you are running command as root user on a CentOS/RHEL 7.x system and want to use use Fedora Epel repository.

Method #1: Install Extra Packages for Enterprise Linux repository configuration (recommended)

Just type the following yum command on a CentOS 7 or RHEL 7:
sudo yum install epel-release

Fig.01: Installing epel-release package on a Centos 7

Note: If method #1 failed, try the following method #2 to install EPEL Repo.

Method #2: Install the extra EPEL repositories from dl.fedoraproject.org

The command is as follows to download epel release for CentOS and RHEL 7.x using wget command:

cd /tmp
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
ls *.rpm

To install epel-release-7-5.noarch.rpm, type:
sudo yum install epel-release-latest-7.noarch.rpm
Sample outputs:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.vbctv.in
 * extras: mirror.vbctv.in
 * updates: mirror.vbctv.in
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
================================================================================
 Package                Arch             Version         Repository        Size
================================================================================
Installing:
 epel-release           noarch           7-11            extras            15 k
 
Transaction Summary
================================================================================
Install  1 Package
 
Total download size: 15 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-11.noarch.rpm                               |  15 kB   00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-11.noarch                                     1/1 
  Verifying  : epel-release-7-11.noarch                                     1/1 
 
Installed:
  epel-release.noarch 0:7-11                                                    
 
Complete!

List your new repos

Once installed you should see epel repo using the following yum repolist command
$ sudo yum repolist
Sample outputs:

Loaded plugins: amazon-id, rhui-lb
repo id                                         repo name                                         status
epel/x86_64                                     Extra Packages for Enterprise Linux 7 - x86_64    5,610
rhui-REGION-client-config-server-7/x86_64       Red Hat Update Infrastructure 2.0 Client Configur     2
rhui-REGION-rhel-server-releases/7Server/x86_64 Red Hat Enterprise Linux Server 7 (RPMs)          4,718
repolist: 10,330

Search and install package

To list all available packages under a repo called epel, enter:
$ sudo yum --disablerepo="*" --enablerepo="epel" list available
OR
$ sudo yum --disablerepo="*" --enablerepo="epel" list available | grep 'package'
OR
$ sudo yum --disablerepo="*" --enablerepo="epel" list available | less
Sample outputs:

Fig. 02: List all available packages under a EPEL Repo on a CentOS/RHEL/Fedora Linux

Example: Search and install htop package from epel repo on a CentOS/RHEL 7.x

The commands are as follows (see yum our command guide for more info):

## search it ##
sudo yum search htop
 
## get more info, if found ##
sudo yum info htop
 
## install it ##
sudo yum install htop

And, there you have it, a larger number of packages to install from EPEL repo on a CentOS and Red Hat Enterprise Linux (RHEL) version 7.x.

See also
This entry is 2 of 3 in the Enable EPEL Repository on a CentOS/RHEL Tutorial series. Keep reading the rest of the series:
  1. CentOS / RHEL / Scientific Linux 6/5 Enable and Install EPEL Repo
  2. How To Install EPEL Repo on a CentOS and RHEL 7.x
  3. yum command: Update / Install Packages Under Redhat Enterprise / CentOS Linux Version 5.x

Posted by: SXI ADMIN

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

14/08/2019

How to KVM, QEMU start or stop virtual machine from command line (CLI)

KVM or Kernel Based Virtual Machine is a popular virtualization technology. It allows you to run virtual guest machines over a host machine. To start...
14/08/2019

How to Docker backup Saving and restoring your volumes

Running a Docker volume backup First, we spin up a temporary container, and we mount the backup folder and the target Docker volume to this container....
12/08/2019

How to Start and Enable Firewalld on CentOS 7

In this article, we discuss how to start and enable firewalld. It is highly recommended that you have a firewall protecting your server.Pre-Flight CheckThese...