This guide will show you how to Manage Repositories with DNF Config Manager Plugin in RHEL. As you must know, DNF is the default package manager for RHEL-based distros. It can be used to install, update, and remove packages on your distribution.
If you are a RHEL-based Linux user, you must face with DNF Config Manager plugin in your daily tasks. The DNF config manager plugin is provided by DNF Plugins Core and it can be used to manage repositories on your server.
Here we want to show you the usage of this plugin with examples.
Steps To Manage Repositories with DNF Config Manager Plugin in RHEL
To show you the guide steps, we will use AlmaLinux 9 as our server. Now follow the steps below to complete this guide.
The Dnf config manager will help you to configure the repositories much more easily.
Step 1 – Syntax Command
The syntax of this command is like the following:
dnf config-manager [options] <section>...
Note: If you face the following error:
dnf-config-manager command not found
You must use the syntax correctly. It shouldn’t have the dash after DNF.
The dnf config-manager plugin must be installed by default in the RHEL-Based distros. If you don’t have it, you can install it by using the command below:
sudo dnf install dnf-plugins-core
Now follow the steps below to see how you can manage your repositories with this plugin.
Step 2 – Add Repositories with DNF Config Manager
At this point, you can use this plugin to add your desired repositories. For this purpose, you should use the –add-repo option with your desired URL. This will help you to add your desired repositories on RHEL. For example:
sudo dnf config-manager --add-repo http://www.example.com/myrepo/
Step 2 – Enable Repositories with DNF Config Manager
After adding your repos, you may want to enable them. This plugin will also help you to enable the repositories by using the –set-enabled option with your added repository. For example:
sudo dnf config-manager --set-enabled myrepo
Step 3 – Disable Repositories with DNF Config Manager
At this point, if you plan to disable your repository, you can easily use the –set-disabled option in the command with your enabled repository. For example:
sudo dnf config-manager --set-disabled myrepo
Step 4 – DNF Config-Manager Options
As you saw, this plugin can help you to configure the repositories much easier. To get more options and usage, you can run the following help command:
sudo dnf config-manager --help-cmd
In the output, you should see:
Output
manage dnf configuration options and repositories
General DNF options:
-c [config file], --config [config file]
config file location
-q, --quiet quiet operation
-v, --verbose verbose operation
--version show DNF version and exit
--installroot [path] set install root
--nodocs do not install documentations
--noplugins disable all plugins
--enableplugin [plugin]
enable plugins by name
--disableplugin [plugin]
disable plugins by name
--releasever RELEASEVER
override the value of $releasever in config and repo
files
--setopt SETOPTS set arbitrary config and repo options
--skip-broken resolve depsolve problems by skipping packages
-h, --help, --help-cmd
show command help
--allowerasing allow erasing of installed packages to resolve
dependencies
-b, --best try the best available package versions in
transactions.
--nobest do not limit the transaction to the best candidate
-C, --cacheonly run entirely from system cache, don't update cache
-R [minutes], --randomwait [minutes]
maximum command wait time
-d [debug level], --debuglevel [debug level]
debugging output level
--debugsolver dumps detailed solving results into files
--showduplicates show duplicates, in repos, in list/search commands
-e ERRORLEVEL, --errorlevel ERRORLEVEL
error output level
--obsoletes enables dnf's obsoletes processing logic for upgrade
or display capabilities that the package obsoletes for
info, list and repoquery
--rpmverbosity [debug level name]
debugging output level for rpm
-y, --assumeyes automatically answer yes for all questions
--assumeno automatically answer no for all questions
--enablerepo [repo] Temporarily enable repositories for the purpose of the
current dnf command. Accepts an id, a comma-separated
list of ids, or a glob of ids. This option can be
specified multiple times.
--disablerepo [repo] Temporarily disable active repositories for the
purpose of the current dnf command. Accepts an id, a
comma-separated list of ids, or a glob of ids. This
option can be specified multiple times, but is
mutually exclusive with `--repo`.
--repo [repo], --repoid [repo]
enable just specific repositories by an id or a glob,
can be specified multiple times
--enable enable repos with config-manager command
(automatically saves)
--disable disable repos with config-manager command
(automatically saves)
-x [package], --exclude [package], --excludepkgs [package]
exclude packages by name or glob
--disableexcludes [repo], --disableexcludepkgs [repo]
disable excludepkgs
--repofrompath [repo,path]
label and path to an additional repository to use
(same path as in a baseurl), can be specified multiple
times.
--noautoremove disable removal of dependencies that are no longer
used
--nogpgcheck disable gpg signature checking (if RPM policy allows)
--color COLOR control whether color is used
--refresh set metadata as expired before running the command
-4 resolve to IPv4 addresses only
-6 resolve to IPv6 addresses only
--destdir DESTDIR, --downloaddir DESTDIR
set directory to copy packages to
--downloadonly only download packages
--comment COMMENT add a comment to transaction
--bugfix Include bugfix relevant packages, in updates
--enhancement Include enhancement relevant packages, in updates
--newpackage Include newpackage relevant packages, in updates
--security Include security relevant packages, in updates
--advisory ADVISORY, --advisories ADVISORY
Include packages needed to fix the given advisory, in
updates
--bz BUGZILLA, --bzs BUGZILLA
Include packages needed to fix the given BZ, in
updates
--cve CVES, --cves CVES
Include packages needed to fix the given CVE, in
updates
--sec-severity {Critical,Important,Moderate,Low}, --secseverity {Critical,Imrtant,Moderate,Low}
Include security relevant packages matching the
severity, in updates
--forcearch ARCH Force the use of an architecture
Config-manager command-specific options:
--save save the current options (useful with --setopt)
--add-repo URL add (and enable) the repo from the specified file or
url
--dump print current configuration values to stdout
--dump-variables print variable values to stdout
--set-enabled enable repos (automatically saves)
--set-disabled disable repos (automatically saves)
repo repo to modify
Conclusion
At this point, you have learned to Use the DNF Config Manager Plugin in RHEL. Just remember that when you want to add and enable a repository, use the repository source you trust. Hope you enjoy it. You may be interested in these articles:
AlmaLinux vs Rocky Linux – Choose Better Distribution