9장. Managing custom software repositories
You can configure a repository in the /etc/dnf/dnf.conf file or in a .repo file in the /etc/yum.repos.d/ directory.
The /etc/dnf/dnf.conf file contains the [main] section and can contain one or more repository sections with a unique repository ID in brackets ([]), for example, ([<repository-ID>]). You can use these sections to define individual DNF repositories by setting repository-specific options. Note that repository IDs must be unique. The values you define in individual repository sections of the /etc/dnf/dnf.conf file override values set in the [main] section for this repository.
For a complete list of available repository ID options, see the [<repository_ID>] OPTIONS section of the dnf.conf(5) man page.
Consider adding your custom repositories in separate .repo files instead of the /etc/dnf/dnf.conf DNF configuration file to avoid possible issues if other programs modify the DNF configuration file.
You can add the DNF repository to your system by using the dnf config-manager --add-repo command. Repositories that you add with this command are enabled by default. However, you can also use the dnf config-manager command to disable the repository.
Obtaining and installing software packages from unverified or untrusted sources other than Red Hat certificate-based Content Delivery Network (CDN) is a potential security risk, and can lead to security, stability, compatibility, and maintainability issues.
Procedure
Add a repository to your system:
# dnf config-manager --add-repo <repository_URL>Review and, optionally, update the repository settings that the previous command created in the
/etc/yum.repos.d/<repository_URL>.repofile:# cat /etc/yum.repos.d/<repository_URL>.repoOptional: Disable the DNF repository added to your system:
# dnf config-manager --disable <repository_ID>To re-enable the repository, enter:
# dnf config-manager --enable <repository_ID>