/etc/yum.repos.d/
The /etc/yum.repos.d/
directory contains repository configuration files for the YUM (Yellowdog Updater, Modified) package manager. Each file in this directory defines a repository that YUM can use to install and update software packages. These repository files are typically suffixed with .repo
.
Structure of Repository Files
A typical repository file contains one or more sections, each corresponding to a different repository. Each section is identified by a repository ID enclosed in square brackets ([]
). The sections contain key-value pairs that specify the repository's details and behavior.
Example Repository File
Here is an example of what a repository file, such as /etc/yum.repos.d/example.repo
, might look like:
Key Directives in Repository Files
name
: A descriptive name for the repository.baseurl
: The base URL where the repository's packages and metadata are located. It can include variables like$releasever
and$basearch
to make it dynamic.enabled
: Determines whether the repository is enabled.1
means the repository is enabled, and0
means it is disabled.gpgcheck
: Specifies whether GPG (GNU Privacy Guard) checking is performed on packages.1
means GPG checking is enabled, and0
means it is disabled.gpgkey
: URL to the GPG key file used for verifying the packages.
Additional Configuration Options
mirrorlist
: URL to a file containing a list of base URLs for the repository. This can be used instead ofbaseurl
.priority
: Assigns a priority to the repository when using theyum-plugin-priorities
. Lower values mean higher priority.exclude
: Excludes specific packages from being installed or updated from this repository.includepkgs
: Limits the repository to only include the specified packages.
Managing Repositories
To add a new repository, create a new .repo
file in the /etc/yum.repos.d/
directory with the appropriate configuration.
Adding a New Repository
For example, to add a new repository, create a file named /etc/yum.repos.d/newrepo.repo
with the following content:
Enabling/Disabling Repositories
To enable or disable a repository, edit the repository file and set the enabled
directive to 1
(enable) or 0
(disable).
Example Commands
List all available repositories:
Enable a specific repository:
Disable a specific repository:
Conclusion
The /etc/yum.repos.d/
directory is a critical component for managing software repositories in YUM. By understanding how to create and configure repository files, you can efficiently manage where YUM looks for packages and how it handles package installations and updates. This flexibility allows for better control over your system's software sources and package management.
Last updated