Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

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

May 10, 2023 CentOSLinuxQuestions 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
RDP Brute Force Protection with PowerShell and Windows Firewall Rules
next post
KVM: How to Expand or Shrink a Virtual Machine Disk Size?

Related Reading

How to Increase Size of Disk Partition in...

October 5, 2023

How to Use Ansible to Manage Windows Machines

September 25, 2023

Fixing ‘The Network Path Was Not Found’ 0x80070035...

August 30, 2023

How to Install and Configure Ansible on Linux

August 27, 2023

Computer Doesn’t Turn Off After Shutting Down Windows...

August 26, 2023

Leave a Comment Cancel Reply

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

  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023
  • How to Use Ansible to Manage Windows Machines

    September 25, 2023
  • Installing Language Pack in Windows 10/11 with PowerShell

    September 15, 2023
  • Configure Email Forwarding for Mailbox on Exchange Server/Microsoft 365

    September 14, 2023
  • How to View and Change BIOS (UEFI) Settings with PowerShell

    September 13, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • How to Configure MariaDB Master-Master/Slave Replication?
  • How to Mount Google Drive or OneDrive in Linux?
  • KVM: How to Expand or Shrink a Virtual Machine Disk Size?
  • Adding VLAN Interface in CentOS/Fedora/RHEL
  • Install and Configure SNMP on RHEL/CentOS/Fedor
  • Configuring High Performance NGINX and PHP-FPM Web Server
  • How to Install and Use ClamAV Antivirus on CentOS/RHEL?
Footer Logo

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


Back To Top