Define global configuration options in the
dnf.conf file. Then edit, or
.repo files to define which repositories to subscribe to.
Configuring the Global DNF Configuration Settings
Edit the main configuration in
/etc/dnf/dnf.conf. The global definitions for DNF are located under the
[main] section heading of the DNF configuration file. The following table lists important directive for DNF.
For backward-compatibility purposes, a symbolic link to
is created at
/etc/yum.conf. The configuration syntax is the same;
although, some configuration options have been deprecated and some new configuration options
have been added. See Comparing Yum Version 3 With DNF for a list of the differences between configuration options
dnf.conf(5) manual page for more information.
||Directory used to store downloaded packages.|
||Logging level, from 0 (none) to 10 (all).|
|| A space separated list of packages to exclude from installs or updates, for example:
||If set to 1, verify the authenticity of the packages by checking the GPG
signatures. You might need to set
||Path to the GPG public key file.|
||Maximum number of versions that can be installed of any one package.|
||If set to 0, remove packages after installation.|
||Path to the dnf log file.|
||If set to 1, replace obsolete packages during upgrades.|
||If set to 1, enable plugins that extend the functionality of dnf.|
||URL of a proxy server including the port number. See Configuring a System to Use a Proxy With a Yum Server|
||Password for authentication with a proxy server.|
||Username for authentication with a proxy server.|
|| Directories where dnf looks for repository files with a
Example [main] Configuration
The following listing shows an example
[main] section from the DNF configuration file.
[main] cachedir=/var/cache/dnf keepcache=0 debuglevel=2 logfile=/var/log/dnf.log obsoletes=1 gpgkey=file://media/RPM-GPG-KEY gpgcheck=1 plugins=1 installonly_limit=3
Configuring a System to Use a Proxy With a Yum Server
If the organization uses a proxy server as an intermediary for internet access, specify the
proxy setting in
/etc/dnf/dnf.conf as shown in the
If the proxy server requires authentication, also specify the
proxy=http://proxysvr.example.com:3128 proxy_username=user proxy_password=password
All dnf users require read access to
these files must be world-readable, don't use a proxy password that's the same as any user's
login password, and especially not
Configuring Access to the Oracle Linux Yum Server Through a Firewall
The Oracle Linux yum server delivers content through a Content Delivery Network (CDN). When you connect to the Oracle Linux yum server, you connect to a node on the CDN that's geographically closer to the system you're using. With CDN, download speeds are faster.
Because the CDN has many nodes that run on different networks around the world, you can not configure any single IP address or network range for an egress firewall rule.
In environments where a strict firewall policy limits outbound connections for systems, we recommend configuring a local yum mirror server within a demilitarized zone (DMZ). See Setting Up a Local Yum Mirror for information on how to configure a local yum mirror.
Subscribing to Different Yum Repositories
Oracle Linux uses modular yum repository configuration files that are made available as release packages that are maintained through yum. Release packages simplify repository management and also ensures that yum repository definitions are kept up-to-date automatically whenever you update the system.
On all Oracle Linux systems, the
oraclelinux-release-el8 package is
installed by default. This package contains the core repository configurations to access all
the repositories required for an Oracle Linux system to install common OS software packages
and the other release packages used to obtain other yum repository configurations.
A list of all available RPM files to manage all the possible yum repository configurations
for a release can be obtained by running the following command, where n is
the Oracle Linux release version of the RPM files, such as
dnf list "*release-eln*"
To install the yum repository configuration for a particular set of software, use the dnf command to install the corresponding package.
Editing Yum Repository Configuration Files
DNF uses yum repository configuration files to configure where to install different packages
and their dependencies from. By default, repository configuration files are stored in the
/etc/yum.repos.d directory. You can define another directory location to
store repository configurations by setting the
reposdir directive in the
Use the repository directory to define
.repo files for repositories that you
want to make available. A
.repo file can contain entries for more than one
yum repository. To subscribe to a repository, you can edit the
to a value of
1 and save the configuration file. The change has immediate
The following table describes the basic directives for a repository. Any other directive that appears in the repository file override the corresponding global definition in the
[main] section of the DNF configuration file. See the
dnf.conf(5) manual page for more information.
|| Location of the repository (expressed as a
||Whether to enable dnf to use the repository. Set the value to 1 to enable the repository, or 0 to disable the repository.|
||Descriptive name for the repository channel. This directive must be specified.|
Example Repository Listing
The following listing shows an example repository section from a
.repo 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
[el8_appstream] name=Oracle Linux $releasever Application Stream ($basearch) baseurl=https://yum.eldistribution.com/repo/EnterpriseLinux/EL8/appstream/$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-el gpgcheck=1 enabled=1
In this example, the values of
gpgcheck override any global setting. dnf substitutes the name of the current system's architecture for the variable $basearch.
Configure Compute Instances Access to Regional Yum Server Repositories
Compute instances in Oracle Cloud Infrastructure have access to regional yum servers through
the service gateway. The base URL of the repository uses the
variable to define which regional server to use and the
to define the domain where the yum server is located. By using variables, configuration can
remain relatively standard across Oracle Linux deployments but provide access to extra
resources available to Oracle Cloud Infrastructure customers.
For example, the base URL to the
ol8_baseos_latest repository for Oracle
Linux 8 is:
You can set the
$ociregion variable by populating content in
/etc/dnf/vars/ociregion. For example, if
$ociregion is set
-phx, the base URL expands to point to the regional yum server located in
Typically, when you create an instance, this value is set to point to the closest regional
yum server on the Oracle Cloud Infrastructure service network. If the
/etc/dnf/vars/ociregion file doesn't exist, or the file is empty, the base
URL points to the publicly accessible Oracle Linux yum server.
Using the DNF config-manager Plugin
dnf-plugins-core package includes several utilities that can help you
to manage configuration and safely apply updates to existing configuration. The most
significant of these utilities is the dnf config-manager plugin.
You can use dnf config-manager to add repositories, either at a specified URL or within a specified repository file. For example, to add a repository configuration file for Oracle Linux that's hosted on a remote server, you can run the following command:
sudo dnf config-manager --add-repo https://example.com/my_yum_config.repo
You can use the same command to automatically generate a repository configuration file for a
valid yum repository by pointing to the URL of which the repository is hosted. For example, to
create a configuration file in
/etc/repos.d for an example repository, run
the following command:
sudo dnf config-manager --add-repo https://example.com/repo/el-release/myrepo/x86_64
To enable a repository by using dnf config-manager, use the
--enable option. For example, to enable a repository named
myrepo, run the following command:
sudo dnf config-manager --enable myrepo
You can use the
--disable option in a similar
way to disable a repository.
You can also use the dnf config-manager tool
to set other configuration options by specifying the
options. See the
manual page for more information.
How to Recover the Base Yum Repository Configuration
- Create a temporary repository configuration file in
sudo mkdir /etc/yum.repos.d/temp_base.repo
- Populate the file with entries corresponding to the system's OS version.
For Oracle Linux 9:
[ol9_baseos_latest] name=Oracle Linux 9 BaseOS Latest ($basearch) baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL9/baseos/latest/$basearch/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle gpgcheck=1 enabled=1
For Oracle Linux 8:
[ol8_baseos_latest] name=Oracle Linux 8 BaseOS Latest ($basearch) baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL8/baseos/latest/$basearch/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle gpgcheck=1 enabled=1
- Reinstall the required release packages of the system's OS version to set up the
standard yum repository configurations.
sudo dnf reinstall oraclelinux-release-olrelease-nbr
- Verify that the recovery is successful.
- Remove the temporary configuration file.
- Reinstall other required release packages to obtain the correct repository
sudo dnf reinstall repository
- Enable the repositories that you need.
sudo dnf config-manager --enable repository