1.2.2 Yum Repository Configuration

Yum repository configuration files are used by DNF to determine where different packages and their dependencies can be installed from.

The yum configuration file or yum repository configuration files can contain one or more sections that define repositories.

The following table describes the basic directives for a repository.

Directive

Description

baseurl

Location of the repository channel (expressed as a file://, ftp://, http://, or https:// address). This directive must be specified.

enabled

If set to 1, permit yum to use the channel.

name

Descriptive name for the repository channel. This directive must be specified.

Any other directive that appears in this section overrides the corresponding global definition in the [main] section of the DNF configuration file. See the dnf.conf(5) manual page for more information.

The following listing shows an example repository section from a configuration file.

[ol8_appstream]
name=Oracle Linux $releasever Application Stream ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/appstream/$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

In this example, the values of gpgkey and gpgcheck override any global setting. dnf substitutes the name of the current system's architecture for the variable $basearch.

The dnf command automatically searches the /etc/yum.repos.d directory for files with the suffix .repo and appends these to the configuration when it is processing. Use this directory to define repository files for repositories that you want to make available.