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:

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.

Note

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.

Note

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.

Warning

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

Listing repositories

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

Listing repositories