Using RPMForge, EPEL and other repositories on CentOS

N
Netooze
January 31, 2020

general information

One of the articles has already discussed the use of the Yum package manager in the CentOS operating system. Now let's deal with the repositories, which are an integral part of the package management infrastructure.

The repository is a centralized repository of compiled and ready-to-install programs with metadata about their compatibility and interdependencies. Repositories are:

  • official - supported by the developers of the OS distribution. They contain packages that are part of the operating system, as well as additional programs that are closely integrated into it;
  • commercial - supported by developers of third-party paid software. Access to such repositories usually requires a subscription;
  • open - maintained by enthusiasts, the community, or free software developers. Open to everyone.

Since the list of software included in the operating system is limited, and developers do not always have time to test and include fresh versions of third-party projects (web servers, mail servers, DBMS, etc.) in their repositories, it is often necessary to connect additional repositories .

There are two main connection methods. The most preferred is to install the repository RPM package. During this operation, all the necessary files are downloaded and created, after which the new repository will appear in the list of connected (command yum repolist ). Another way is to create the repository settings file yourself in the /etc/yum.repos.d/ directory . The file must have the repo extension and contain the following parameters:

[repo]
name=repo_name
baseurl=repo_url

Description of parameters:

[repo] - short name of the repository;
name is the full name of the repository;
baseurl - link to the repository (can be replaced by the mirrorlist parameter or metalink - link to the list of regional mirrors of the repository);
gpgcheck - whether to check the digital signature of packages (if the value of the parameter is 1 - check, if 0 - do not check);
gpgkey - the location of the public key of the repository, with which the signature is verified;
enabled - whether the repository is used when searching and installing packages (1 - used, 0 - the repository is disabled).

All required values ​​for the specified parameters can usually be found on the website of the respective repository.

Connecting a third-party repository

When it comes to distributions based on Red Hat Linux, the most popular repository recommended for connection is Extra Packages for Enterprise Linux (EPEL). On CentOS servers deployed from our templates , this repository is already enabled. If the operating system is installed from scratch, connecting EPEL is quite simple:

yum install epel-release

The RPM package with EPEL settings is already included in the official CentOS repository, so all the necessary files and GPG keys will be downloaded automatically. If we look at the contents of the /etc/yum.repos.d/epel.repo file , we will see the already familiar parameters:

Another common repository is Remi`s RPM repository, which contains up-to-date versions of the PHP stack packages. The EPEL repository must be included in the OS, as the Remi packages depend on the EPEL repository packages. Detailed information can be found at https://rpms.remirepo.net/. To connect, just download the RPM package and run its installation:

wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm

Let's run yum repolist and make sure the repositories are registered with the operating system:

By default, only the remi-safe repository is enabled - it contains packages that do not replace the packages of the operating system distribution, which minimizes possible conflicts and problems in operation. If we look at the list of REPO files that have appeared, we will see a fairly large list:

These repositories are disabled and must be enabled by the server administrator when required. To enable the repository permanently, set the enabled=1 parameter in the corresponding REPO file. For one-time operations, use the --enablerepo=repo_name parameter in the corresponding yum command, for example:

yum --enablerepo=remi install php

One of the previously widely used third-party repositories was RepoForge (RPMForge), but, unfortunately, it is no longer supported at the moment. Although the repository is physically accessible, the packages in it have not been updated for a long time, and therefore it is not recommended to use it. If, for some reason, you need to use it, connecting it is also quite simple - on the page http://repoforge.org/use/ we find a link to the required version, download the package and install it. For example, for CentOS 7:

wget http://repository.it4i.cz/mirrors/repoforge/redhat/el7/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
yum localinstall rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

Start your cloud journey? Take the first step right now.