..
Copyright (C) 2014-2018 Red Hat, Inc.
This copyrighted material is made available to anyone wishing to use,
modify, copy, or redistribute it subject to the terms and conditions of
the GNU General Public License v.2, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY expressed or implied, including the implied warranties of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details. You should have received a copy of the
GNU General Public License along with this program; if not, see
. Any Red Hat trademarks that are
incorporated in the source code or documentation are not subject to the GNU
General Public License and may only be used or replicated with the express
permission of Red Hat, Inc.
.. _command_ref-label:
#######################
DNF Command Reference
#######################
========
Synopsis
========
``dnf [options] [...]``
===========
Description
===========
.. _command_provides-label:
`DNF`_ is the next upcoming major version of `YUM`_, a package manager for RPM-based Linux
distributions. It roughly maintains CLI compatibility with YUM and defines a strict API for
extensions and plugins.
Plugins can modify or extend features of DNF or provide additional CLI commands on top of those
mentioned below. If you know the name of such a command (including commands mentioned below), you
may find/install the package which provides it using the appropriate virtual provide in the form of
``dnf-command()``, where ```` is the name of the command; e.g. ``dnf install
'dnf-command(versionlock)'`` installs a ``versionlock`` plugin. This approach also applies to
specifying dependencies of packages that require a particular DNF command.
.. _exit_codes-label:
Return values:
* ``0`` : Operation was successful.
* ``1`` : An error occurred, which was handled by dnf.
* ``3`` : An unknown unhandled error occurred during operation.
* ``100``: See :ref:`check-update `
* ``200``: There was a problem with acquiring or releasing of locks.
Available commands:
* :ref:`alias `
* :ref:`autoremove `
* :ref:`check `
* :ref:`check-update `
* :ref:`clean `
* :ref:`deplist `
* :ref:`distro-sync `
* :ref:`downgrade `
* :ref:`group `
* :ref:`help `
* :ref:`history `
* :ref:`info `
* :ref:`install `
* :ref:`list `
* :ref:`makecache `
* :ref:`mark `
* :ref:`module `
* :ref:`provides `
* :ref:`reinstall `
* :ref:`remove `
* :ref:`repoinfo `
* :ref:`repolist `
* :ref:`repoquery `
* :ref:`repository-packages `
* :ref:`search `
* :ref:`shell `
* :ref:`swap `
* :ref:`updateinfo `
* :ref:`upgrade `
* :ref:`upgrade-minimal `
Additional information:
* :ref:`Options `
* :ref:`Specifying Packages `
* :ref:`Specifying Provides `
* :ref:`Specifying File Provides `
* :ref:`Specifying Groups `
* :ref:`Specifying Transactions `
* :ref:`Metadata Synchronization `
* :ref:`Configuration Files Replacement Policy `
* :ref:`Files `
* :ref:`See Also `
.. _options-label:
=======
Options
=======
``-4``
Resolve to IPv4 addresses only.
``-6``
Resolve to IPv6 addresses only.
``--advisory=, --advisories=``
Include packages corresponding to the advisory ID, Eg. FEDORA-2201-123.
Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
``--allowerasing``
Allow erasing of installed packages to resolve dependencies. This option could be used as an alternative to the ``yum swap`` command where packages to remove are not explicitly defined.
``--assumeno``
Automatically answer no for all questions.
``-b, --best``
Try the best available package versions in transactions. Specifically during :ref:`dnf upgrade `, which by default skips over updates that can not be installed for dependency reasons, the switch forces DNF to only consider the latest packages. When running into packages with broken dependencies, DNF will fail giving a reason why the latest version can not be installed.
Note that the use of the newest available version is only guaranteed for
the packages directly requested (e.g. as a command line arguments), and the
solver may use older versions of dependencies to meet their requirements.
``--bugfix``
Include packages that fix a bugfix issue.
Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
``--bz=, --bzs=``
Include packages that fix a Bugzilla ID, Eg. 123123.
Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
``-C, --cacheonly``
Run entirely from system cache, don't update the cache and use it even in case it is expired.
DNF uses a separate cache for each user under which it executes. The cache for the root user is called the system cache. This switch allows a regular user read-only access to the system cache, which usually is more fresh than the user's and thus he does not have to wait for metadata sync.
``--color=``
Control whether color is used in terminal output. Valid values are ``always``, ``never`` and ``auto`` (default).
``--comment=``
Add a comment to the transaction history.
``-c , --config=``
Configuration file location.
``--cve=, --cves=``
Include packages that fix a CVE (Common Vulnerabilities and Exposures) ID
(http://cve.mitre.org/about/), Eg. CVE-2201-0123.
Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
``-d , --debuglevel=``
Debugging output level. This is an integer value between 0 (no additional information strings) and 10 (shows all debugging information, even that not understandable to the user), default is 2. Deprecated, use ``-v`` instead.
``--debugsolver``
Dump data aiding in dependency solver debugging into ``./debugdata``.
.. _disableexcludes-label:
``--disableexcludes={all|main|}, --disableexcludepkgs={all|main|}``
Disable ``excludepkgs`` and ``includepkgs`` configuration options. Takes one of the following three options:
* ``all``, disables all ``excludepkgs`` and ``includepkgs`` configurations
* ``main``, disables ``excludepkgs`` and ``includepkgs`` defined in the ``[main]`` section
* ``repoid``, disables ``excludepkgs`` and ``includepkgs`` defined for the given repository
Note that the \-\ :ref:`-exclude ` option appends to the ``[main]`` ``excludepkgs`` configuration and therefore is disabled when ``main`` or ``all`` is specified.
``--disable, --set-disabled``
Disable specified repositories (automatically saves). The option has to be used together with the
``config-manager`` command (dnf-plugins-core).
.. _disableplugin-label:
``--disableplugin=``
Disable the listed plugins specified by names or globs.
``--disablerepo=``
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``.
``--downloaddir=, --destdir=``
Redirect downloaded packages to provided directory. The option has to be used together with the \-\
:ref:`-downloadonly ` command line option, with the
``download``, ``modulesync``, ``reposync`` or ``system-upgrade`` commands (dnf-plugins-core).
.. _downloadonly-label:
``--downloadonly``
Download the resolved package set without performing any rpm transaction (install/upgrade/erase).
Packages are removed after the next successful transaction. This applies also when used together
with ``--destdir`` option as the directory is considered as a part of the DNF cache. To persist
the packages, use the ``download`` command instead.
``-e , --errorlevel=``
Error output level. This is an integer value between 0 (no error output) and
10 (shows all error messages), default is 3. Deprecated, use ``-v`` instead.
``--enable, --set-enabled``
Enable specified repositories (automatically saves). The option has to be used together with the
``config-manager`` command (dnf-plugins-core).
``--enableplugin=``
Enable the listed plugins specified by names or globs.
``--enablerepo=``
Temporarily enable additional 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.
``--enhancement``
Include enhancement relevant packages.
Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
.. _exclude_option-label:
``-x , --exclude=``
Exclude packages specified by ```` from the operation.
``--excludepkgs=``
Deprecated option. It was replaced by the \-\ :ref:`-exclude ` option.
``--forcearch=``
Force the use of an architecture. Any architecture can be specified.
However, use of an architecture not supported natively by your CPU will
require emulation of some kind. This is usually through QEMU. The behavior of ``--forcearch``
can be configured by using the :ref:`arch ` and :ref:`ignorearch `
configuration options with values ```` and ``True`` respectively.
``-h, --help, --help-cmd``
Show the help.
.. _installroot-label:
``--installroot=``
Specifies an alternative installroot, relative to where all packages will be
installed. Think of this like doing ``chroot dnf``, except using
``--installroot`` allows dnf to work before the chroot is created. It requires absolute path.
- *cachedir*, *log files*, *releasever*, and *gpgkey* are taken from or
stored in the installroot. *Gpgkeys* are imported into the installroot from
a path relative to the host which can be specified in the repository section
of configuration files.
- *configuration file* and :ref:`reposdir ` are searched inside the installroot first. If
they are not present, they are taken from the host system.
Note: When a path is specified within a command line argument
(``--config=`` in case of *configuration file* and
``--setopt=reposdir=`` for *reposdir*) then this path is always
relative to the host with no exceptions.
- *vars* are taken from the host system or installroot according to :ref:`reposdir `
. When *reposdir* path is specified within a command line argument, vars are taken from the
installroot. When :ref:`varsdir ` paths are specified within a command line
argument (``--setopt=varsdir=``) then those path are always relative to the host with no
exceptions.
- The *pluginpath* and *pluginconfpath* are relative to the host.
Note: You may also want to use the command-line option
``--releasever=`` when creating the installroot, otherwise the
*$releasever* value is taken from the rpmdb within the installroot (and thus
it is empty at the time of creation and the transaction will fail). If ``--releasever=/`` is used, the
releasever will be detected from the host (``/``) system. The new installroot path at the time of creation
does not contain the *repository*, *releasever* and *dnf.conf* files.
On a modular system you may also want to use the
``--setopt=module_platform_id=`` command-line option when creating the installroot,
otherwise the :ref:`module_platform_id ` value will be taken from the
``/etc/os-release`` file within the installroot (and thus it will be empty at the time of creation, the modular
dependency could be unsatisfied and modules content could be excluded).
Installroot examples:
``dnf --installroot= --releasever= install system-release``
Permanently sets the ``releasever`` of the system in the
```` directory to ````.
``dnf --installroot= --setopt=reposdir= --config /path/dnf.conf upgrade``
Upgrades packages inside the installroot from a repository described by
``--setopt`` using configuration from ``/path/dnf.conf``.
``--newpackage``
Include newpackage relevant packages.
Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
``--noautoremove``
Disable removal of dependencies that are no longer used. It sets
:ref:`clean_requirements_on_remove ` configuration option to ``False``.
``--nobest``
Set best option to ``False``, so that transactions are not limited to best candidates only.
``--nodocs``
Do not install documentation. Sets the rpm flag 'RPMTRANS_FLAG_NODOCS'.
``--nogpgcheck``
Skip checking GPG signatures on packages (if RPM policy allows).
``--noplugins``
Disable all plugins.
.. _obsoletes_option-label:
``--obsoletes``
This option has an effect on an install/update, it enables
dnf's obsoletes processing logic. For more information see the
:ref:`obsoletes ` option.
This option also displays capabilities that the package obsoletes when used together with the :ref:`repoquery ` command.
Configuration Option: :ref:`obsoletes `
``-q, --quiet``
In combination with a non-interactive command, shows just the relevant content. Suppresses messages notifying about the current state or actions of DNF.
``-R , --randomwait=``
Maximum command wait time.
.. _refresh_command-label:
``--refresh``
Set metadata as expired before running the command.
``--releasever=``
Configure DNF as if the distribution release was ````. This can
affect cache paths, values in configuration files and mirrorlist URLs.
``--releasever_major=``
Override the releasever_major variable, which is usually automatically
detected or taken from the part of ``$releasever`` before the first ``.``.
This option does not affect the ``$releasever`` variable.
``--releasever_minor=``
Override the releasever_minor variable, which is usually automatically
detected or taken from the part of ``$releasever`` after the first ``.``.
This option does not affect the ``$releasever`` variable.
.. _repofrompath_options-label:
``--repofrompath ,``
Specify a repository to add to the repositories for this query.
This option can be used multiple times.
- The repository label is specified by ````.
- The path or url to the repository is specified by ````.
It is the same path as a baseurl and can be also enriched by the
:ref:`repo variables `.
- The configuration for the repository can be adjusted using \-\
:ref:`-setopt `\=.