Install DNF5 on Fedora 39 for Faster Package Management
In this article
DNF5 is the next-generation package manager for Fedora, offering noticeably faster dependency resolution, lower memory usage, and quicker transaction processing compared to the classic DNF4. On Fedora 39, you can install DNF5 as an optional package and start using it immediately—it works alongside the default DNF4, so you can switch back anytime. This guide walks you through the installation, basic usage, and troubleshooting.
What You'll Need
- A Fedora 39 installation (Workstation, Server, or any spin) with an active internet connection.
- sudo privileges (your user must be in the
wheelgroup). - Terminal access—all steps are command-line based.
Step-by-Step
- Update your system first. Open a terminal and run:
This ensures all existing packages are up to date, reducing the chance of dependency conflicts when installing DNF5.sudo dnf upgrade --refresh - Install DNF5. The package is available in the official Fedora repositories. Run:
DNF4 will be used to install DNF5—this is normal. Confirm the installation when prompted.sudo dnf install dnf5 - Verify the installation. Check the version to confirm it's working:
You should see output likednf5 --versiondnf5 version 5.x.x. - Use DNF5 for everyday tasks. The command syntax is very similar to DNF4. For example:
- Install a package:
sudo dnf5 install <package-name> - Remove a package:
sudo dnf5 remove <package-name> - Search for a package:
dnf5 search <keyword> - Update all packages:
sudo dnf5 upgrade
dnf5for history, info, and autoremove—just like DNF4. - Install a package:
- Optionally, make DNF5 your default. If you prefer DNF5 over DNF4, you can create an alias in your shell configuration file (e.g.,
~/.bashrcfor Bash):
Then reload withalias dnf='dnf5'source ~/.bashrc. This only affects your user; system tools still use DNF4 unless changed system-wide. - Keep DNF5 updated. Since DNF5 is a regular package, it will be updated along with the rest of the system when you run
sudo dnf upgradeorsudo dnf5 upgrade.
Common Mistakes
- Running DNF5 as root without sudo. Always use
sudo dnf5for system-level changes. Runningdnf5 installwithout sudo will fail with a permission error. - Assuming DNF5 replaces DNF4 automatically. It doesn't—both coexist. You must explicitly use
dnf5to invoke it. - Using incompatible commands. While DNF5 is largely compatible, some obscure DNF4 options are not yet implemented. If a command fails, check the help (
dnf5 --help) or fall back to DNF4. - Not updating before install. Skipping the upgrade step can lead to dependency errors, especially if your system is several weeks old.
Tips
- Use
dnf5 historyto undo changes. DNF5 keeps a transaction history, so you can revert a recent install or removal withsudo dnf5 history undo <ID>. - Speed up with parallel downloads. DNF5 enables parallel downloads by default, but you can tune the number of simultaneous downloads in
/etc/dnf/dnf.confby settingmax_parallel_downloads=10(or higher). - Test commands with
--assumeno. Add--assumenoto any transaction command to see what would happen without actually doing it. For example:sudo dnf5 install <package> --assumeno. - Use
dnf5 providesto find which package owns a file. This is handy when you need a command but don't know the package:dnf5 provides /usr/bin/ffmpeg.
Troubleshooting
If DNF5 fails to install:
- Make sure your system is fully updated:
sudo dnf upgrade --refresh. - Check that the package is available:
dnf list dnf5. If it's not listed, your repositories might be misconfigured—runsudo dnf repolistto verify.
If DNF5 commands error with “unknown option” or “unrecognized argument”:
- DNF5 is still evolving; some DNF4 options are not yet ported. Use
dnf5 --helpto see supported options, or fall back to DNF4 for that specific task.
If DNF5 is slow or hangs:
- Check your network connection and try again. If the problem persists, clear the DNF5 cache:
sudo dnf5 clean all. - If a transaction is stuck, you can interrupt with
Ctrl+Cand runsudo dnf5 historyto see if it left a partial transaction. You can undo it withsudo dnf5 history undo last.
If DNF5 and DNF4 conflict:
- They should coexist peacefully, but if you see errors about locked databases, wait a moment and try again—only one package manager can run at a time.
- If you ever want to remove DNF5, simply run
sudo dnf remove dnf5(using DNF4).
Frequently Asked Questions
Is DNF5 faster than DNF4?
Yes, in most cases. DNF5 uses a C++ core and has improved parallel downloading, which reduces dependency resolution time and overall transaction time, especially on systems with many packages.
Can I use DNF5 and DNF4 interchangeably?
Yes, they use the same repositories and package database. You can install with one and remove with the other, though it's best to stick to one for a given transaction to avoid confusion.
Will DNF5 break my system?
No. DNF5 is a drop-in replacement that has been tested in Fedora 39. It's safe to use for daily operations, and you can always revert to DNF4 if you encounter issues.
Do I need to uninstall DNF4?
No. DNF4 remains the default until Fedora 41, and many system tools still rely on it. Keep both installed.
Can I set DNF5 as the default for all users?
Yes, but it's not recommended unless you know what you're doing. You can create a symlink or modify system aliases, but this may break scripts that expect DNF4 behavior. It's safer to use the alias method for your own shell.
What if a package isn't found with DNF5 but is with DNF4?
This is unlikely since they share repositories, but if it happens, run sudo dnf5 makecache to refresh metadata, then try again. If it still fails, use DNF4 to install that package.