If you would like to learn how to list the dependencies of an RPM package using DNF, then you have to read this post. So, when you are going to install an RPM package, you will know exactly what it requires from the system.
As we all know, RPM is a package format for Red Hat or SUSE Linux derivatives. Like DEB format packages, RPMs contain instructions and binaries about applications to be installed on Linux.
However, an RPM package might need other packages to be installed, and today we will find out what they are in a quick and easy way thanks to DNF
How to list dependencies of a RPM package using DNF
DNF is a marvel of a package manager and thanks to it, we can quickly resolve the issue.
First, update the system. Although it is not necessary for this post, it is always good to remember it.
sudo dnf update
Now as root user or with sudo permissions, you have to run this command
sudo dnf repoquery --requires [package]
Suppose the package is httpd
.
dnf repoquery --requires httpd
You will get an output screen like this
Last metadata expiration check: 0:06:28 ago on Fri 23 Dec 2022 02:03:28 AM UTC.
/bin/sh
httpd-core = 2.4.53-7.el9
libbrotlienc.so.1()(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libsystemd.so.0()(64bit)
libsystemd.so.0(LIBSYSTEMD_209)(64bit)
rtld(GNU_HASH)
system-logos-httpd
systemd-units
In it, you can see which dependencies are required for the package.
As an important point, it does not require the packages to be installed, but the dnf command will also inspect those that are not in the system.
As you can see, it is effortless and can help us a lot.
Conclusion
DNF is the package manager for RHEL, Fedora, CentOS and other distributions of the family. It is so powerful that you can easily know the dependencies of a package, even if it has not been installed yet.
I hope this little trick will help you.