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]
- yum: Command used in yum package management.
- repolist: Shows all the configured and enabled repositories.
- [OPTIONS]: Command options to modify the output. Multiple options can be used at a time.
Check out the yum repolist command with some command options:
- Check the list with detailed info on each repo:
sudo 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 the 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
- yum-utils: Package that includes yum tools and utilities.
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 run the following command in the terminal:
sudo yum-config-manager \ --add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
- sudo: Grants root privilege.
- yum-config-manager: Adds/removes a Yum repository.
- – -add-repo: Command option that adds a new repository to the system.
- https://download.docker.com/linux/centos/docker-ce.repo: Repository URL.
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
- – -disable: This option will disable the following repository.
- docker-ce-stable: The repository I want to disable.
Next, check if it has 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
- update: Instructs the package manager to update the repository log.
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:
Enabling 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.
Disabling Priority: 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:
- RPMFusin:
It offers packages that are not included in the Fedora or Red Hat repositories, expanding software availability.
- EPEL:
EPEL (Extra Packages for Enterprise Linux) provides the latest packages and extra packages for RHEL, CentOS, & Fedora.
URL: https://docs.fedoraproject.org/en-US/epel/
- REMI:
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.
URL: https://rpms.remirepo.net/
- 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.
URL: http://elrepo.org/tiki/HomePage
- Webtatic:
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.
Conclusion
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!
People Also Ask
How do I list Yum repositories?
To list yum repos in your system, use the command syntax, yum repolist all
. This will give the list of all repositories in your RPM-based Linux distro regardless of the repository being enabled or disabled.
What’s the difference between yum repolist and yum repolist all command?
The yum repolist
command lists all the enabled repositories including their status and available packages for installation. On the other hand, the yum repolist all
command provides an extensive list of both enabled and disabled repositories along with the overall repository configuration.
How to remove a Yum repository?
To remove a yum repository, first, open the terminal and run the command sudo yum repolist enabled
to list all the enabled repositories. Then type the command sudo yum-config-manager –disable <repository name or ID> on the prompt and press ENTER. For instance, running the command on the terminal sudo yum-config-manager --disable epel
removes the EPEL repository.
Can I view disabled Yum repositories?
Yes, you can. Open the terminal and run the command yum repolist disabled
. This command specifically enlists repositories that are currently disabled on the system.
Where are the yum repositories?
YUM (Yellowdog Updater, Modified) repositories are typically hosted on remote servers and can be accessed via the Internet. The specific location (URL) of YUM repositories can vary depending on the repository provider and the Linux distribution you are using.
How to list all repos in Linux?
To list all repositories configured on your Linux system, first, you have to see which Linux distro and Package Manager you are using. As commands used for viewing the repository list vary based on the distro & package manager. For APT, use the command syntax, ‘apt list –all-repos’, for YUM, use ‘yum repolist –all’ & for Pacman use, ‘pacman -Slq’.
How do I find my yum repo ID?
To find the YUM repository ID, you can use the yum repolist
command. This command will list all the configured YUM repositories on your system along with their respective IDs.
Related Articles
- Ubuntu Repository List [A Total Guide]
- Debian Repository List [A Total Insight]
- APT Repository List [An Essential Guide]
- CentOS Repository List in Linux [A Complete Guide]
- Best Ubuntu Repositories [Choose Wisely]
<< Go Back to Linux Repository List | Package Management in Linux | Learn Linux Basics
FUNDAMENTALS A Complete Guide for Beginners