DNF5 is the latest version of the DNF package manager, which is used for installing, updating, and managing software on Fedora and other Red Hat-based Linux distributions.
It brings several improvements over the older DNF version, such as better performance, security, and a more flexible plugin system.
In this article, we’ll walk you through how to use the dnf5 command for various tasks like installing packages, updating your system, and managing repositories.
Basic Syntax of the dnf5 Command
The basic syntax for using dnf5
is:
dnf5 [OPTIONS] COMMAND [PACKAGE...]
OPTIONS
: These are flags that modify the behavior of the command (e.g.,-y
to automatically confirm actions).COMMAND
: The action you want to perform, such as install, remove, or update.PACKAGE
: The name of the software package you want to manage.
Here are some of the most commonly used dnf5
commands.
1. Install a Package
To install a software package, use the install
command. For example, to install a VLC media player, you would run:
sudo dnf5 install vlc -y
2. Update Packages
To update all installed packages to their latest versions, use the update
command:
sudo dnf5 update
If you only want to update a specific package, use the following command:
sudo dnf5 update vlc
3. Remove a Package
If you want to remove a package from your system, use the remove
command, which will uninstall the package and any dependencies that were installed with it, if they are no longer needed by other packages.
sudo dnf5 remove vlc
4. Search for a Package
To search for a package, use the search
command, which will return a list of packages that match the search term.
dnf5 search vlc
5. List Installed Packages
To see a list of all installed packages on your system, use the list
command, which will show you all the packages that are currently installed on your system.
dnf5 list
6. Show Package Information
If you want to see detailed information about a package, such as its version, description, and dependencies, use the info
command:
dnf5 info vlc
7. Clean the Cache
Over time, your system’s package manager can accumulate a lot of cached data. You can clean this cache to free up disk space using the clean
command:
sudo dnf5 clean all
8. Manage Repositories
DNF5 allows you to manage software repositories (sources where packages are downloaded from). You can list all enabled repositories with the following command:
dnf5 repolist
To add a new repository, you would typically need to modify the repository configuration files in /etc/yum.repos.d/
. However, you can also use the dnf5
command to enable or disable repositories:
Enable a repository:
sudo dnf5 config-manager --set-enabled repository-name
Disable a repository:
sudo dnf5 config-manager --set-disabled repository-name
9. Upgrade the System
To upgrade your entire system to the latest available versions of all installed packages, use the upgrade
command:
sudo dnf5 upgrade
This will update your system to the latest versions of all packages, including any new dependencies.
10. Downgrade a Package
If you need to revert a package to an older version, use the downgrade
command.
sudo dnf5 downgrade vlc
11. Check for Package Dependencies
Sometimes, you may need to check for missing or broken dependencies in a package. You can use the deplist
command to show the dependencies of a specific package:
dnf5 deplist vlc
This will list all the dependencies required by the VLC package.
Conclusion
The dnf5
command is a powerful tool for managing software packages on Fedora and other Red Hat-based Linux distributions. With its improved performance, security, and flexibility, DNF5 makes it easier to install, update, remove, and manage software on your system.