If you use Fedora 44, you are using DNF5 now even if you do not know it. The old DNF4 is gone and your old commands only work because Fedora helper tools make them work. This guide shows you the real new DNF5 commands so you can install things quickly, fix errors easily, and make your computer fast. We will learn how to search, install, upgrade, and fix problems with step by step guides.
First, you need to check if your computer is really using DNF5. You can open your terminal and check the files.
Step 1: Check your DNF5 version
You must write this command to see where the terminal shortcut goes:
readlink -f /usr/bin/dnf
This command should show you /usr/bin/dnf5 on your screen. Now, check the version of DNF5 by typing this command:
dnf5 --version
When you run this command, it will print many lines. It should say dnf5 version 5.4.2.1 or a higher number. It also shows you the loaded plugins like builddep, changelog, copr, and config-manager. If your computer does not have DNF5 for some reason, you can install it using this command:
sudo dnf5 install dnf5 dnf5-plugins
This will install the package manager and the extra tools that help it do more things.
Step 2: How to search and find packages
Before you install any app, you need to find out if Fedora has it. You can do this with simple search commands.
To search for an app like htop, type this command:
dnf5 search htop
To see detailed information about the app, like how big it is and what it does, type this command:
dnf5 info htop
If you want to see all the kernels installed on your system, type this command:
dnf5 list --installed "kernel*"
This is very good to use when your hard drive is full and you want to see which old kernels are taking up your space.
If you have a file on your computer but do not know which package it belongs to, type this command:
dnf5 provides /usr/bin/htop
If you want to know what other packages need this app, or what this app needs to run, you can use these commands:
dnf5 repoquery --requires htop
dnf5 repoquery --whatrequires libcurl
If you want to see what the developers changed in the update before you install it, use this command:
dnf5 changelog htop
This command is very good because it reads the text from the internet so you do not have to install the package first to see the changes.
Step 3: How to install, reinstall, and delete packages
Installing apps with DNF5 is very simple but there are some special options you can use to make it better.
To install htop, type this command:
sudo dnf5 install -y htop
The -y option is good because it says yes to everything automatically so you do not have to press the Y key on your keyboard.
If you do not want to install extra packages that are not necessary, type this command:
sudo dnf5 install -y --setopt=install_weak_deps=False htop
This keeps your system very light and clean.
If your app is broken and you want to install it again to fix it, type this command:
sudo dnf5 reinstall -y htop
To delete the app from your computer, type this command:
sudo dnf5 remove -y htop
After you delete many apps, you might have useless files left on your computer. To clean them up, type this command:
sudo dnf5 autoremove -y
If you want to swap one package for another package without breaking your system, use the swap command like this:
sudo dnf5 swap ffmpeg-free ffmpeg –allowerasing
To see a list of packages that you installed yourself and are not needed by other apps, type this command:
dnf5 leaves
This is useful to find apps that you forgot you installed so you can delete them and save space.
Step 4: How to update your computer
Updating your computer often is very important so you get security fixes.
To see what updates are ready for your computer, type this command:
sudo dnf5 check-upgrade
To install every update, type this command:
sudo dnf5 upgrade -y
If you only want to install small security fixes because you are scared that big updates will break your system, type this command:
sudo dnf5 upgrade-minimal -y
To make all your packages match the versions on the Fedora servers exactly, type this command:
sudo dnf5 distro-sync -y
If you have an important package like the kernel and you do not want it to ever update, you can lock it. First, install the versionlock plugin:
sudo dnf5 install -y dnf5-plugins
Now, lock your kernel package using this command:
sudo dnf5 versionlock add kernel-core
If you want to see all your locked packages, type this command:
sudo dnf5 versionlock list
If you change your mind and want to let the package update again, type this command:
sudo dnf5 versionlock delete kernel-core
Step 5: How to use groups and environments
Sometimes you want to install many apps at the same time for a specific job, like programming. Fedora groups these apps together.
To see all the groups, type this command:
dnf5 group list
To see what apps are inside a group called Development Tools, type this command:
dnf5 group info "Development Tools"
To install the whole group of apps at once, type this command:
sudo dnf5 group install -y "Development Tools"
Environments are even bigger than groups because they change your whole desktop look. To see all the desktop environments, type this command:
dnf5 environment list
Step 6: How to manage repositories and COPR
Repositories are online stores where Fedora gets your apps. You can add new stores to get more apps.
To see all your active stores, type this command:
dnf5 repo list
To add a new store using a web link, type this command:
sudo dnf5 config-manager addrepo --from-repofile=https://download.docker.com/linux/fedora/docker-ce.repo
To enable a store that is turned off, type this command:
sudo dnf5 config-manager setopt fedora-cisco-openh264.enabled=1
To turn off a store, type this command:
sudo dnf5 config-manager disable fedora-cisco-openh264
COPR is a special place where normal people share their own apps. To use COPR, follow these steps.
First, enable the COPR repository you want:
sudo dnf5 copr enable atim/starship
Now, install the app from that repository:
sudo dnf5 install -y starship
To see all the COPR repositories you use, type this:
sudo dnf5 copr list
To turn off the COPR repository, type this:
sudo dnf5 copr disable atim/starship
To delete the repository file completely, type this:
sudo dnf5 copr remove atim/starship
Step 7: How to see your history and undo mistakes
DNF5 remembers everything you install or delete. If you make a mistake, you can go back in time.
To see a list of everything you did, type this command:
sudo dnf5 history list
This will show you a table with numbers. Each number is a transaction. To see details about transaction number 5, type this command:
sudo dnf5 history info 5
If transaction 5 installed a bad package that broke your computer, you can undo it by typing this command:
sudo dnf5 history undo 5
This will delete the packages that were installed in that step and reinstall anything you deleted.
If you have two computers and want to install the exact same packages on both, you can save your transaction to a file. On your first computer, type this command:
sudo dnf5 install --store=/tmp/dev-install htop tmux fish
Copy that folder to your second computer and run this command on the second computer:
sudo dnf5 replay /tmp/dev-install
This makes the second computer do the exact same thing as the first one.
Step 8: Make your DNF5 download very fast
By default, DNF5 downloads files slowly because it only downloads 3 files at the same time. You can change this to 10 to make it very fast.
Open the configuration file using a text editor:
sudo vi /etc/dnf/dnf.conf
Change the file so it looks like this:
[main]
gpgcheck=True
installonly_limit=3
clean_requirements_on_remove=True
best=False
skip_if_unavailable=True
max_parallel_downloads=10
fastestmirror=True
defaultyes=True
keepcache=True
Here is what these settings mean in simple words:
- gpgcheck: Checks if the package is safe and has a real signature. Always keep this True.
- installonly_limit: How many old kernels to keep. 3 is a good number.
- clean_requirements_on_remove: Deletes extra dependencies when you delete an app.
- best: If the newest app has a problem, it will install a slightly older one instead of failing.
- skip_if_unavailable: If one online store is down, do not stop the whole update.
- max_parallel_downloads: Downloads 10 files at once. This makes updates finish much faster.
- fastestmirror: Finds the download server that is closest to your house.
- defaultyes: You do not have to press Y every time you install something.
- keepcache: Keeps the downloaded files on your disk so you do not have to download them again if the installation fails.
After you save this file, clear the old files and update the system information:
sudo dnf5 makecache
sudo dnf5 clean all
Step 9: How to upgrade Fedora to a new version
When Fedora releases a new version, you can upgrade your system safely using these steps.
First, update your current system completely:
sudo dnf5 upgrade -y
Next, download the files for the new version, for example Fedora 44:
sudo dnf5 system-upgrade download --releasever=44
This will download all the big files in the background while you use your computer. Once it is finished, restart your computer to start the upgrade process:
sudo dnf5 system-upgrade reboot
Your computer will restart and show a progress screen. Do not turn off your computer. After it boots back to your desktop, you can check if it worked:
sudo dnf5 system-upgrade status
If something went wrong, you can look at the logs using this command:
sudo dnf5 system-upgrade log
To clean up the big download files after a successful upgrade, type this command:
sudo dnf5 system-upgrade clean
Step 10: How to fix common DNF5 errors
Sometimes you will see errors in your terminal. Here is how to fix the three most common ones.
If you see an error that says “Public key is not installed”, it means your computer does not trust the online store. You can fix this by importing the security key manually:
sudo rpm --import https://download.docker.com/linux/fedora/gpg
Then try to install your app again.
If you see a dependency problem error where packages conflict, you can try to disable the bad repository to see if it fixes the problem:
sudo dnf5 upgrade --disablerepo=docker-ce-stable
If you see an error that says “Cannot download Packages: All mirrors were tried”, your internet or the Fedora servers are having a bad day. You can clear the cache and tell DNF5 to try more times:
sudo dnf5 clean all
sudo dnf5 --setopt=retries=20 makecache
sudo dnf5 upgrade -y
This tells the package manager to try 20 times before giving up, which usually fixes temporary network errors.
