Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / Linux / How to Install & Configure Repositories in CentOS/RHEL

March 11, 2024 LinuxQuestions and Answers

How to Install & Configure Repositories in CentOS/RHEL

The standard (official) RHEL/CentOS repositories offer a small number of basic packages that do not always contain the latest versions of programs. However, you can use third-party public or private repositories to install new programs in Red Hat Enterprise Linux, CentOS, Oracle Linux and Scientific Linux. Remi and EPEL are the most popular third-party repositories. In this article, we’ll look on how to install, manage and use additional repositories with the yum (dnf) package manager in CentOS.

Contents:
  • How to Enable EPEL and Remi Repository in CentOS?
  • Repository Configuration Files (*.repo)
  • How to Disable a Repository in CentOS?
  • How to Check Repo for Available Package Updates?
  • Popular ThirdParty Repositories for CentOS and RHEL

The repository is an updatable store of RPM software packages for Linux. Different package managers may use network repositories to install and update programs.

How to Enable EPEL and Remi Repository in CentOS?

When you install an OS (in our example, it is CentOS 7), basic repositories are installed by default. You can view the list of them using the command:

yum repolist

yum repolist

As you can see in the screenshot, there are 3 repositories installed in the system — base, extras, updates. These are enough to start installing basic software and additional repositories.

Let’s consider how to install extra repositories in CentOS.

EPEL may be the most popular repository today.

EPEL (Extra Packages for Enterprise Linux) is an open and free repository project provided by Fedora team. It contains high-quality packages of additional software for Linux distros. This repository hosts a large number of packages from FTP servers to PHP and system monitoring tools. This is the most popular repository. It is worth to note that EPEL packages do not conflict with native CentOS/RHEL packages and don’t replace them.

It is very easy to install EPEL in CentOS 7 (unlike CentOS 6) using RPM package (it is the easiest method to add a new repo):

yum install epel-release

yum dnf repolist - list conected repos on centos/rhel

After being installed, the repository appears in the repo list without any actions (you do not need to clear the yum cache).

To install Remi repository on CentOS, run this command:

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

Remi is another popular repository for CentOS. It contains the latest PHP and MySQL versions. It was created by Remi Collet. To use this repository, EPEL repo must be enabled in your OS. Please note that some of its packages may conflict with the packages from the basic repos.

If there is no RPM package for the repository you need, you can add it by creating a config file .repo in /etc/yum.repos.d manually (see the next article section).

To understand, which repositories the packages are installed from, you can display the full list of packages:

yum list installed

As you can see, every package has the information about the repository it is installed from (there are base, update, epel and anaconda repos on the screenshot below).

yum list islalled packages with repository sources

You can display the list of packages available for installation in a specific repo:

yum repo-pkgs epel list

Repository Configuration Files (*.repo)

All repository configuration files are located in /etc/yum.repos.d/ and have the *.repo extension. A typical config file contains the following parameters:

  • name — the repository name
  • baseurl — the link to a repository (it may be ftp://address, http://address, https://address or file://address for a local repo)
  • enabled – whether this repo must be used: 1 — the repo is enabled, 0 — the repo is disabled;
  • async – whether to use parallel package downloading (auto/on/off)
  • gpgcheck – whether to perform a GPG check (1 — the check is on)
  • gpgkey — a link to a GPG key
  • exclude — the list of excluded packages
  • includepkgs — the list of included packages
  • mirrorlist – the list of repository mirrors

The smallest repo file may look like this:

[rep_name]
name=rep_name
baseurl=rep_url

For example, after you have install the REMI repository, some Remi (remi-*.repo) configuration files will appear in the repository directory.

/etc/yum.repos.d - list of connected repos on centos/rhel/fedora

As you can see, Remi has a separate configuration file for each PHP version. You must enable the PHP version you need via the config file. For example, I will have PHP 7.3 installed on my server, so I have enabled the corresponding repo (I have specified enabled=1 in remi-php73.repo):

configuring repo file in centos

You can connect the repository manually. To do it, create a repository configuration file in /etc/yum.repos.d/. Let’s add the MariaDB repo.

nano /etc/yum.repos.d/mariadb.repo

Add the data provided by MariaDB package developer to it:

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos73-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

How to Disable a Repository in CentOS?

In order to disable one of the installed repositories, it is enough to specify enabled=0 in its configuration file.

disable repo in centos via config file

Then clean the yum cache:

yum clean all

And recreate it:

yum makecache

After that remi-php73 repo won’t be used when you install or update packages.

If you do not want to use a repository only for the current package update/installation command, you can disable it in the yum command, for example:

yum update —disablerepo=epel

In this example, we have disabled EPEL and updated installed packages.

You can temporarily disable all repositories you do not need. For instance, to update packages only from MariaDB repository, run the command:

yum update --disablerepo "*" --enablerepo=mariadb

To disable or remove repos, the yum-config-manager that belongs to yum-utils tools is used.

Install yum-utils:

yum -y install yum-utils

Disable a repository, for example, remi:

yum-config-manager --disable remi

To remove a repository completely, you must remove its configuration files and update yum cache.

How to Check Repo for Available Package Updates?

You can check a specific repository for available package update.

yum check-update --disablerepo "*" --enablerepo=mariadb

yum check-update with disablerepo and enablerepo

Thus, you can manage the connected repos on your server. Note that different repositories may contain the same packages, and version conflicts may occur during update. So leave only the repositories you work with enabled.

Popular ThirdParty Repositories for CentOS and RHEL

MariaDB repo, as you can guess by its name, contains MariaDB packages. The repository has been created by MariaDB developers, it is constantly supported and updated.

To install this repository in the system, create a .repo file with the following contents:

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos73-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Like the previous repository, Nginx contains packages related to the nginx HTTPD server.

To install the nginx repo, create a .repo file and add the following text here:

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/CentOS/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key

This list of repositories is enough to configure the so-called LAMP stack with nginx as a front-end server.

This repository list may be enough for almost any user, however, I will give some more examples.

Webtatic is supported by a limited number of experts, mostly it is Andy Thompson. It contains PHP related packages, but it is less popular than Remi, since the latest PHP version in this repository had been 7.2 by the time this article was written.

yum repo-pkgs webtatic list | grep php7

mod_php71w.x86_64 7.1.31-1.w7 webtatic
mod_php72w.x86_64 7.2.21-1.w7 webtatic
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
php72w-tidy.x86_64 7.2.21-1.w7 webtatic
php72w-xml.x86_64 7.2.21-1.w7 webtatic
php72w-xmlrpc.x86_64 7.2.21-1.w7 webtatic

To enable the repository, install the following RPM package:

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

MySQL is what I want to remind of. I have not placed it together with the popular ones, since I think MySQL as a database server has lost its positions. MariaDB is usually installed on the servers instead. However, if somebody wants to install MySQL, you can enable this repo. For example, you want to install mysql 5.7:

Download the package:

wget http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

And install it:

rpm -Uvh mysql57-community-release-el7-9.noarch.rpm

After the installation I can install MySQL:

install mysql from repo in centos

In this article, we have shown some aspects of repository management in CentOS and studied some useful repositories.

0 comment
1
Facebook Twitter Google + Pinterest
previous post
Protecting Remote Desktop (RDP) Host from Brute Force Attacks
next post
KVM: How to Expand or Shrink a Virtual Machine Disk Size?

Related Reading

Map a Network Drive over SSH (SSHFS) in...

May 13, 2025

Configure NTP Time Source for Active Directory Domain

May 6, 2025

How to Cancel Windows Update Pending Restart Loop

May 6, 2025

View Windows Update History with PowerShell (CMD)

April 30, 2025

Remove ‘Your License isn’t Genuine’ Banner in MS...

April 21, 2025

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMware
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025
  • How to Write Logs to the Windows Event Viewer from PowerShell/CMD

    March 3, 2025
  • How to Hide (Block) a Specific Windows Update

    February 25, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • How to Configure MariaDB Master-Master/Slave Replication
  • KVM: How to Expand or Shrink a Virtual Machine Disk Size?
  • Ubuntu/Mint/Kali Boots to Initramfs Prompt in BusyBox
  • How to Install and Use ClamAV Antivirus on CentOS/RHEL
  • Install and Configure SNMP on RHEL/CentOS/Fedor
  • Configuring High Performance NGINX and PHP-FPM Web Server
  • Configuring Routing on Linux (RHEL/CentOS)
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top