dnf – Next Generation RPM Package Manager

DNF is a package manager for RPM-based Linux distributions, which includes Fedora, RHEL, CentOS, and others. It is a next-generation package manager that is designed to improve upon the previous YUM package manager. It is a command-line tool that allows users to install, update, and remove packages, as well as search for available packages from configured repositories.

Overview

DNF is a command-line tool that can be used to manage packages on RPM-based Linux distributions. The basic syntax for using DNF is as follows:

dnf [options] [command] [package(s)]

Here are some examples of how to use DNF:

To install a package:

dnf install package_name

To remove a package:

dnf remove package_name

To update all packages:

dnf update

To search for a package:

dnf search package_name

To list all installed packages:

dnf list installed

To list all available packages:

dnf list available

Options

Here is a table of available options for the DNF command:

Option Description
-y, –assumeyes Automatically answer yes to prompts
-q, –quiet Quiet mode
-v, –verbose Verbose mode
-h, –help Display help information
-C, –cacheonly Run entirely from system cache, don’t update cache
-c, –config Specify an alternate configuration file
-R, –randomwait Randomize the wait time for commands

Troubleshooting tips

Here are some common issues and their solutions when using DNF:

  • Error: Failed to synchronize cache for repo: This error occurs when DNF is unable to download metadata from the configured repositories. To fix this, run dnf clean all to clear the cache and try again.
  • Error: No package available: This error occurs when DNF is unable to find the specified package. Make sure that the package name is correct and that the repository that contains the package is enabled.
  • Error: Package already installed: This error occurs when attempting to install a package that is already installed. To update the package, use the dnf update command instead.

Notes

  • DNF is the default package manager for Fedora and CentOS 8 and later versions.
  • DNF is backward-compatible with YUM, so YUM commands can still be used with DNF.
  • The DNF command requires root privileges to run.