How do I turn on the EPEL repository for my Amazon EC2 instance running CentOS, RHEL, or Amazon Linux?
Last updated: 2022-12-20
I want to turn on access to the Extra Packages for Enterprise Linux (EPEL) repository in an Amazon Elastic Compute Cloud (Amazon EC2) instance running CentOS, Red Hat Enterprise Linux (RHEL), or Amazon Linux-based distribution.
Short description
Standard repositories might not provide all the packages that can be installed on CentOS, RHEL, or Amazon Linux-based distribution. Turning on the EPEL repository provides additional options for package installation.
Resolution
Follow these steps to download, install, and turn on the EPEL repository on CentOS, RHEL, or Amazon Linux-based distribution.
To verify the distribution, run the following command:
cat /etc/os-release
Amazon Linux
Amazon Linux 2:
Install the EPEL release package for RHEL 7 and turn on the EPEL repository:
sudo amazon-linux-extras install epel -y
RHEL
RHEL 8:
Install the EPEL release package for RHEL 8.
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
RHEL 7:
Install and turn on the EPEL release package for RHEL 7:
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
CentOS
CentOS 8:
Install the EPEL release package for RHEL 8. Turn on both the EPEL and PowerTools repositories. The PowerTools repository contains development tools required by many EPEL packages:
sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
sudo dnf config-manager --set-enabled PowerTools
CentOS 7:
Install and turn on the EPEL release package. CentOS 7 includes the epel-release package in the base repositories:
sudo yum -y install epel-release
List repositories that are turned on
To verify that the EPEL repository is turned on, run the repolist command:
sudo yum repolist
Related information
Did this article help?
Do you need billing or technical support?