Installing applications on Linux derivatives such as CentOS, Rocky Linux, and RHEL may require investigating the dependencies needed for the RPM packages you are installing with the DNF Package manager. Knowing what files and processes will be affected during an installation can help in certain situations, mainly around troubleshooting.
The following tutorial will go over some quick examples using an RHEL clone Rocky Linux machine and the “HTTPd” package for the example outputs with the dnf repoquery command. Note the same methods can be used on any Linux distribution that uses the DNF package manager.
List RPM Dependencies with RPM in Linux
The following list I created has two examples. As explained in the introduction using the HTTPd or Apache web server. All you need to do is replace the HTTPd with the package name you wish to investigate, but you should get familiar with the examples below.
- To list the direct dependencies of the HTTPd package:
dnf repoquery --requires httpd
- To list the indirect dependencies of the HTTPd package (i.e., the dependencies of its dependencies):
dnf repoquery --resolve --requires httpd
In this small tutorial, you have learned to list an RPM package’s dependencies for Linux distribution users with the DNF package manager installed as the default package manager. You can use this information to investigate the requirements of different packages better. This will be handy when troubleshooting dependency issues or deciding which packages to install on your system. With this knowledge, you should be able to manage rpm dependencies with ease.