Menu Close
Chapter 10. Managing custom software repositories
The configuration information for DNF and related utilities are stored in the /etc/dnf/dnf.conf
file. This file contains one or more [repository]
sections, which allow you to set repository-specific options.
It is recommended to define individual repositories in new or existing .repo
files in the /etc/yum.repos.d/
directory.
Note that the values you define in individual [repository]
sections of the /etc/dnf/dnf.conf
file override values set in the [main]
section.
The following sections describe how to manage custom software repositories in Red Hat Enterprise Linux 9:
-
Section 10.1. "Setting DNF repository options" describes how to set
[repository]
options. - Section 10.2. "Adding a DNF repository" describes how to define a new DNF repository.
- Section 10.3. "Enabling a DNF repository" describes how to enable a DNF repository added to your system.
- Section 10.4. "Disabling a DNF repository" describes how to disable a DNF repository added to your system.
10.1. Setting DNF repository options
The /etc/dnf/dnf.conf
configuration file contains the [repository]
sections, where repository is a unique repository ID. The [repository]
sections allow you to define individual DNF repositories.
Do not give custom repositories names used by the Red Hat repositories to avoid conflicts.
For a complete list of available [repository]
options, see the [repository] OPTIONS
section of the dnf.conf(5)
man page.
10.2. Adding a DNF repository
To define a new repository, you can either:
-
Add a
[repository]
section to the/etc/dnf/dnf.conf
file. Add a
[repository]
section to a.repo
file in the/etc/yum.repos.d/
directory.Installed RPMs or software management tools, for example, Subscription Manager, can provide their own
.repo
file.
Define your repositories in a .repo
file instead of /etc/dnf/dnf.conf
as all files with the .repo
file extension in this directory are read by dnf
.
The following procedure describes how to add a DNF repository to your system.
Procedure
Add a repository to your system:
# dnf config-manager --add-repo repository_URL
Replace repository_url with URL pointing to the repository.
Obtaining and installing software packages from unverified or untrusted sources other than Red Hat certificate-based Content Delivery Network
(CDN) constitutes a potential security risk, and could lead to security, stability, compatibility, and maintainability issues.
10.3. Enabling a DNF repository
The following procedure describes how to enable a DNF repository added to your system.
Procedure
Enable a repository:
# dnf config-manager --enable repositoryID
Replace repositoryID with the unique repository ID.
Additional resources
10.4. Disabling a DNF repository
The following procedure describes how to disable a DNF repository added to your system.
Procedure
Disable a repository:
# dnf config-manager --disable repositoryID
Replace repositoryID with the unique repository ID.
Additional resources