How to Configure Repositories on CentOS 8

Only a small number of packages are available in pre-installed CentOS repositories. Moreover, these are not always the latest versions. This is why you often need to connect additional repositories. This process will be described in this tutorial.

To see installed repositories in CentOS use the command:

yum repolist

To list all packages with their versions in the repository (change BaseOS to any repository name):

yum repo-pkgs BaseOS list

Installing popular additional repositories on CentOS 8

EPEL (Extra Packages for Enterprise Linux) contains a huge number of packages. This is the most popular additional repository. Let’s install it.

yum install epel-release

Remi is another popular additional repository for CentOS 8. To use it, Epel must be installed on the system. Please note that packages from this repository have the same names as in the official ones, so this may lead to unwanted updates. To install it, use the command:

rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-8.rpm

Installing a repository for a single package

Let’s consider installing an individual repository using Mysql as an example. This method allows you to get the latest updates much earlier than they appear in other package repositories, such as BaseOS or EPEL.
Download the package:

wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm

And install it.

rpm -Uvh mysql80-community-release-el8-1.noarch.rpm

Disabling and deleting repositories

To avoid using the repository during the current system update, use the command:

yum update --disablerepo=remi-modular

To disable a repository in the system without deleting it, use:

yum-config-manager --disable epel

After that you can enable it again:

yum-config-manager --enable epel

To completely delete a repository, use the following command with the appropriate name:

yum remove epel-release