Linux dnf command: modern package manager in Fedora

Introduction

In the Linux ecosystem, package management is a key task to keep the system up to date and safe. In Fedora, the dnf command has replaced the old yum as a default manager, offering a faster, more reliable and secure experience for users and administrators.

What is DNF?

DNF, an acronym of Dandified YUM, is the next generation package manager developed by Red Hat. It uses a libsolv-based architecture for the resolution of dependencies, which allows faster calculations and a lower consumption of resources against its predecessor.

Advantages over YUM

Among the most notable improvements are higher performance in unit resolution, better conflict management, native support for modules and groups, and a more coherent command line interface. In addition, DNF includes security improvements, such as default GPG signature verification.

Basic installation and configuration

In a standard Fedora installation, DNF is already pre-installed. If for any reason missing, you can install with the commandsudo dnf install dnf. The main configuration file is found in/etc/dnf/dnf.confwhere options such as the maximum number of parallel downloads or the location of the repositories can be adjusted.

Common operations: search and installation

To search for a package is useddnf search palabra_clave. The installation is done withsudo dnf install nombre_paquete. DNF automatically resolves the dependencies and shows a summary before proceeding, allowing the user to confirm or cancel the operation.

Updating and removal of packages

Updating the entire system is as simple as runningsudo dnf upgrade. To update a specific package your name is indicated after the command. The elimination is done withsudo dnf remove nombre_paqueteand DNF also eliminates those dependencies that are no longer necessary if the parameter is specified--autoremove.

Group and module management

DNF allows to work with groups of packages bydnf group list, dnf group install nombre_grupoanddnf group remove nombre_grupo. The modules, introduced in Fedora Modularity, allow to install different versions of the same application; they are managed withdnf module list, dnf module install nombre_modulo:versiónanddnf module remove nombre_modulo.

History and transactions

Each operation with DID is recorded in your history. The commanddnf historyshows a list of transactions anddnf history info IDyou can see the details of a specific transaction. It is possible to reverse or repeat a transaction usingdnf history undo IDordnf history redo ID.

Common problem solution

If there are dependency errors, you can try to clean the cache withsudo dnf clean alland then run the operation again. In case of file conflicts, DNF usually offers options to replace or maintain the current file. The detailed logs are found in/var/log/dnf.logand are useful for debugging installation or updating failures.

Good practices and advice

It is recommended to executednf upgrade --refreshregularly to ensure that the metadata of the repositories are updated. Use the flag--assumenoallows to simulate operations without making changes, useful to review which packages would be affected. Finally, keeping the system back up before making more updates helps to mitigate unexpected risks.

Conclusion

DNF represents a significant advance in the management of packages for Fedora and other RPM-based distributions. Its speed, reliability and set of features make it an essential tool for both day-to-day users and system managers. Dominating its use allows you to maintain an up-to-date, safe and efficient Linux environment.

This work is under aCreative Commons License Attribution 4.0 International for Francesc Roig francesc @ vivaldi.net.

EnglishenEnglishEnglish