A YUM (Yellowdog Updater, Modified) repository, is a repository of software packages for the high-level Yum package manager which is commonly used in Red Hat-based Linux distributions such as RHEL, CentOS, and Fedora. YUM configures repositories for handling software packages by taking care of dependencies automatically. From this article, you will learn the basics of YUM repository configuration & how you can manage the repository list to handle them effectively.
What is a YUM Repository?
A YUM repository is essentially a collection of software packages and metadata files organized in a specific directory structure on a server or a network location. YUM package manager uses these repositories to find and retrieve packages and their dependencies when you want to install or update software on your Linux system.
Yum Repository Configuration
Repository configuration is essential for efficient package management. Yum repository configurations are found in files with ‘.repo’ extensions within the ‘/etc/yum.repos.d/’ directory. To configure repositories in YUM, you will work with these ‘.repo’ files. These files contain the necessary information for YUM to access software packages and metadata. Now, for custom configurations, you can either use existing ‘.repo’ files or create new ones. Additionally, /etc/yum.conf is a file containing global configuring options.
A typical repo configuration file entry contains the following information:
- [repository-name]: Repository’s unique identifier.
- name: Provides a human-readable name for the repository.
- baseurl: Points to the URL where the repository’s package is hosted.
- enabled: Is set to ‘1’ to enable the repository.
- gpgcheck: Is set to ‘1’ to enable GPG signature checking for package authenticity.
- gpgkey: Specifies the URL for the GPG key used ro sign packages.
Red-Hat-Based Repository list
Red Hat-based Linux distributions such as RHEL, CentOS, and Fedora use YUM as a package manager. YUM is similar in function and purpose to APT in Debian-based distributions like Ubuntu. Besides, it supports plugins that extend its functionality, allowing you to customize and enhance the package management experience.
Some official repositories used by Red-Hat_Based distros are enabled by default, such as:
- Base Repository → The core set of packages that make up CentOS. It contains essential software and libraries required for the operating system.
- Updates Repository → Updated packages to the Base Repository released after the CentOS ISOs. This includes security, bugfix, or enhancement updates.
- Extras → Additional packages that are not in the Base or Updates repositories, such as new Kernel modules or third-party software.
Managing YUM Repository List
For maintaining your Red-Hat-based Linux system, Managing YUM is an important task. Repository lists determine where your package manager, such as YUM, looks for software packages and updates. Here are some basic operations you can perform to manage your repository list:
1. Viewing the Yum Repositories List
By typing and running a single line command, you can list all the Yum repositories including any newly added ones on your system. To view the list use the following command syntax:
yum repolist [OPTIONS]
Check out the yum repolist command with some command options:
- Check the list with detailed info on each repo:
yum -v repolist
From the images, you can see the verbose information of each repository that is present in my system. From there you can see each ID, name, version, last update time, number of packages, number of packages available for installation, size, URL, & filename. Moreover, at the bottom, you can also view the number of total packages available.
- Check the list of only enabled repos:
yum repolist enabled
- Check the list of only disabled repos:
yum repolist disabled
- Check the list of all repos:
yum repolist all
From the image, you can notice the long list (all of them didn’t fit in the screen) of repositories (both disabled & enabled) that are present in my system.
2. Adding a New Yum Repository
To add a Yum repository using the command line on an RPM-based Linux distribution (such as CentOS, Fedora, or RHEL), you can create a ‘.repo’ file in the ‘/etc/yum.repos.d/’ directory with the repository configuration, and finally update Yum cache after adding.
Or you can simply use the ‘yum-config-manager’ command. For that, you need the yum-utils package to be installed for working with the command. So first let’s install the package by the following command:
sudo yum install yum-utils
After executing the command, you will see a prompt for confirmation to install the packages. There type ‘y’ which indicates ‘yes’ to all yum-utils packages.
Now that I have successfully added yum-tools, let’s add a new repository in my system, say ‘docker’. For that copy the following command:
sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
From the image, you can see the new repository ‘docker-ce-stable’ has been added.
3. Removing a Yum Repository
Yum does not provide a built-in option for removing repositories. But what you can do is you can temporarily disable any of the repositories with the –disable option of the ‘yum-config-manager’ command or you can manually go to the ‘/etc/yum.repos.d/’ file & then remove the corresponding repository configuration file. You can also use the rm command to remove that configured repo file if you know about it beforehand. For that, first, let’s see the list of enabled repositories in my system:
sudo yum repolist enabled
From the list, you can see all of my enabled repository IDs & names that are present in my system.
Now I will disable my previously added docker repository using the following command:
sudo yum-config-manager --disable docker-ce-stable
Next, check if it has really been disabled or not using the ‘yum repolist all’ command I used previously.
From the image, you can see I have successfully disabled the ‘docker’ repository.
4. Updating the Repository Info
After adding or modifying repositories, you need to update the repository information. You can do this by using the following command:
sudo yum update
From the snap, you can notice that I have updated my system list after the repository modification.
Priorities in Yum Repositories
Yum offers a feature called Repository Priorities that can be effective at times. As it can be assigned to control the preference of one repository over another when resolving package dependencies. Priority values are integers that range from 1 (highest priority) to 99 (lowest priority). Here are some important terms you need to know to learn how it works:
- Higher Priority Repositories: When multiple repositories provide the same package, YUM will prefer the package from the repository with the highest priority.
- Conflict Resolution: If there is a conflict between packages from different repos (e.g., conflicting dependencies), YUM will prioritize the package from the higher-priority repository.
- Multiple Repositories of the Same Priority: In this situation, YUM will choose the package from the most recently updated repository.
Configuring Repository Priority
You can configure your repository priorities by enabling & disabling priority levels for them. Here’s how you can set & unset a repository priority:
You can manually set the priority of a YUM repository by editing the configuration file located in the ‘/etc/yum.repos.d/’ directory. Just add a line in the configuration file, like ‘priority=N’, where ‘N’ is the desired priority value.
To disable the set priority you can just remove the priority line from the configuration file.
List of Some Top YUM Repositories
Besides the official YUM repositories, there are some top third-party repositories that are frequently recommended by the Linux community. Some of these repos with their official URL are:
It offers packages that are not included in the Fedora or Red Hat repositories, expanding software availability.
EPEL (Extra Packages for Enterprise Linux) provides the latest packages and extra packages for RHEL, CentOS, & Fedora.
REMI’s repository is known for providing the latest versions of PHP and related software packages for CentOS, Fedora, and RHEL systems. It offers both PHP updates and compatibility packages.
- EL Repo
EL Repo (Enterprise Linux Repo) is dedicated to providing hardware-related packages and drivers for CentOS and RHEL systems. It is particularly useful for managing hardware support.
Webtatic offers up-to-date versions of various web-related software packages, including PHP, and MySQL for CentOS and RHEL systems. It is commonly used for web server setups.
Advantages of Installing Software From YUM Repositories
Installing software from YUM repositories in red-hat-based Linux distros offers several advantages. Some of them are:
- Easy Software Management → Yum simplifies the installation process by handling dependencies automatically. Moreover, it serves as a centralized location for software distribution.
- Security → Packages are often signed with GPG (GNU Privacy Guard) keys, ensuring the authenticity of the software.
- Version Control → Contains multiple versions of packages, allowing users to install specific versions or update to the latest version.
- Software Dependency Resolution → Software dependencies are automatically resolved and installed.
- Official Red Hat Package Manager → YUM is the official Red Hat package manager.
- Community & Third-party Repositories → Along with official repositories, there are community and third-party repositories that extend the range of available software.
To sum up, managing YUM repository lists is essential for installing and maintaining software packages on your Linux system. It allows you to control which software sources your package manager uses, ensuring a well-maintained and secure system. Hope this writing helps you in managing them!