2018-05-25 19:54:28 +00:00
= Using the DNF software package manager
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
DNF is a software package manager that installs, updates, and removes packages on Fedora and is the successor to YUM (Yellow-Dog Updater Modified).
DNF makes it easy to maintain packages by automatically checking for dependencies and determines the actions required to install packages.
This method eliminates the need to manually install or update the package, and its dependencies, using the `rpm` command.
2019-02-21 19:23:43 +00:00
DNF is now the default software package management tool in Fedora.
2018-01-26 18:29:28 +00:00
2018-03-27 03:41:50 +00:00
[[sect-usage]]
== Usage
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
`dnf` can be used exactly as `yum` to search, install or remove packages.
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
To search the repositories for a package type:
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
----
2022-10-15 16:35:31 +00:00
# dnf search packagename
2018-03-27 03:41:50 +00:00
----
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
To install the package:
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
----
2018-08-11 10:11:44 +00:00
# dnf install packagename
2018-03-27 03:41:50 +00:00
----
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
To remove a package:
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
----
2018-08-11 10:11:44 +00:00
# dnf remove packagename
2018-03-27 03:41:50 +00:00
----
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
Other common DNF commands include:
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
* `autoremove` - removes packages installed as dependencies that are no longer required by currently installed programs.
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
* `check-update` - checks for updates, but does not download or install the packages.
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
* `downgrade` - reverts to the previous version of a package.
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
* `info` - provides basic information about the package including name, version, release, and description.
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
* `reinstall` - reinstalls the currently installed package.
2017-10-26 21:20:01 +00:00
2019-05-24 15:45:39 +00:00
* `upgrade` - checks the repositories for newer packages and updates them.
2017-10-26 21:20:01 +00:00
2019-11-01 12:28:07 +00:00
* `exclude` - exclude a package from the transaction.
2019-10-30 15:15:41 +00:00
2021-02-02 11:30:52 +00:00
For more DNF commands refer to the man pages by typing `man dnf` at the command-line, or link:https://dnf.readthedocs.io/en/latest/command_ref.html[DNF Read The Docs]
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
[[sect-automatic-updates]]
== Automatic Updates
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
The `dnf-automatic` package is a component that allows automatic download and installation of updates.
It can automatically monitor and report, via e-mail, the availability of updates or send a log about downloaded packages and installed updates.
2017-10-26 21:20:01 +00:00
2021-02-02 11:30:52 +00:00
For more information, refer to the link:https://dnf.readthedocs.org/en/latest/automatic.html[Read the Docs: DNF-Automatic] page.
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
[[sect-system-upgrades]]
== System Upgrades
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
The Fedora system can be upgraded directly with DNF, or with the DNF system upgrade plugin.
2019-03-22 15:20:33 +00:00
Refer to the xref:dnf-system-upgrade.adoc[DNF System Upgrade] document for more details.
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
[[sect-language-support-using-dnf]]
== Language Support Using DNF
2017-10-26 21:20:01 +00:00
2018-03-27 03:41:50 +00:00
DNF can be used to install or remove Language Support.
2019-03-22 15:20:33 +00:00
A detailed description with a list of available languages can be found on link:https://fedoraproject.org/wiki/I18N/Language_Support_Using_Dnf[Language Support Using Dnf] page.
2017-10-26 21:20:01 +00:00
2018-08-11 08:42:30 +00:00
[[sect-plugins]]
== Plugins
The core DNF functionality can be extended with plugins.
There are officially supported https://dnf-plugins-core.readthedocs.io[Core DNF plugins]
2018-08-11 10:11:44 +00:00
and also third-party https://dnf-plugins-extras.readthedocs.io[Extras DNF Plugins].
2018-08-11 08:42:30 +00:00
To install them, run
----
2018-08-11 10:11:44 +00:00
# dnf install dnf-plugins-core-PLUGIN_NAME
2018-08-11 08:42:30 +00:00
----
or
----
2018-08-11 10:11:44 +00:00
# dnf install dnf-plugins-extras-PLUGIN_NAME
2018-08-11 08:42:30 +00:00
----
2019-11-01 12:28:07 +00:00
[[exclude-package]]
== Excluding Packages From Transactions
2019-10-30 15:15:41 +00:00
2019-11-01 12:28:07 +00:00
Sometimes it is useful to ignore specific packages from transactions, such as updates.
One such case, for example, could be when an update includes a regression or a bug.
DNF allows you to exclude a package from the transaction:
2019-10-30 15:15:41 +00:00
2019-11-01 12:28:07 +00:00
* using the command line
2019-10-30 15:15:41 +00:00
----
sudo dnf upgrade --exclude=packagename
----
2019-11-01 12:28:07 +00:00
* using its configuration files
2019-10-30 15:15:41 +00:00
2019-11-01 12:28:07 +00:00
You can add a line to `/etc/dnf/dnf.conf` to exclude packages:
2019-10-30 15:15:41 +00:00
----
excludepkgs=packagename
----
2019-11-01 12:28:07 +00:00
This can also be added to the specific repository configuration files in `/etc/yum.repos.d/`.
https://en.wikipedia.org/wiki/Glob_(programming)[Globs] may be used here to list multiple packages, and each specification must be separated by a comma.
If you have used this configuration, you can disable it in individual DNF commands using using the `--disableexcludes` command line switch.
2019-10-30 15:15:41 +00:00
2019-11-01 12:28:07 +00:00
If you use a GUI update application which does not allow you to specify packages to exclude when they run, this method can be used.
2019-10-30 15:15:41 +00:00
2021-10-10 23:36:33 +00:00
[[sect-using-dnf-plugin]]
2019-11-01 12:28:07 +00:00
=== Using the DNF Versionlock plugin
You can also use the DNF `versionlock` plugin to limit the packages that are included in a transaction.
It allows you to list what versions of particular packages should be considered in a transaction.
All other versions of the specified packages will be ignored.
The plugin is part of `dnf-plugins-core` package and can be installed using the command below:
2019-10-30 15:15:41 +00:00
----
sudo dnf install 'dnf-command(versionlock)'
----
2019-11-01 12:28:07 +00:00
To lock the currently installed version of a package, use:
2019-10-30 15:15:41 +00:00
----
sudo dnf versionlock add package
----
2019-11-01 12:28:07 +00:00
To remove the version lock, use:
2019-10-30 15:15:41 +00:00
----
sudo dnf versionlock delete package
----
2019-11-01 12:28:07 +00:00
The `list` command can be used to list all locked packages, while the `clear` command will delete all locked entries.
2018-03-27 03:41:50 +00:00
[[sect-references]]
== References
2017-10-26 21:20:01 +00:00
2021-02-02 11:30:52 +00:00
. https://dnf.readthedocs.io/en/latest/command_ref.html[DNF Command Reference]
2018-08-11 10:11:44 +00:00
. https://github.com/rpm-software-management/dnf/wiki[DNF wiki]
2019-10-30 15:15:41 +00:00
. https://dnf-plugins-core.readthedocs.io/en/latest/versionlock.html[DNF VersionLock]