How to list RPM dependencies?

Solution 1:

The yum deplist command will show you which rpm's are dependencies, here's an example for the expect package (this will work even if you don't yet have the package installed locally):

# yum deplist expect
..
..
package: expect.i386 5.43.0-5.1
 dependency: libc.so.6
  provider: glibc.i686 2.5-49
  provider: glibc.i686 2.5-49
 dependency: libtcl8.4.so
  provider: tcl.i386 8.4.13-4.el5

Solution 2:

  1. rpm -q --requires somepackagehere

  2. One is the i?86 package, the other is the x86_64 package.


Solution 3:

Following on Ignacio's answer, you can see the specific architecture of the packages by doing the following:

$ rpm -qa --queryformat "%{NAME} %{ARCH}\n" sqlite
sqlite i686

In my case, I only have the one, i686 package...but you can get the architecture associated with the packages that way. If you are interested in what else you can get from the --queryformat, issue a rpm --querytags to see the list of variables available.


Solution 4:

I have quick shell snippet which prints out all installed packages along with their dependencies:

for i in `rpm -qa` ; do echo "Package [$i]:"; rpm -q --requires $i ; echo ; done

Solution 5:

People have already responded with:

  1. rpm -q --requires PKG
  2. yum -q deplist PKG

Yes, either rpm or yum works and correctly answers the question. The main difference between rpm and yum is that yum also shows what packages you can install to meet the library and/or file requirements. Unfortunately, if the package isn't installed, neither one of these methods are useful. Since the original poster already specified that the package you are checking is installed, this is a mute point.

What if you didn't have the package installed? yum can still be used, but indirectly. You can do a mock install by canceling the install operation.

printf n  |  yum install PKG  |  grep -- "---> Package"

Here is an example:

printf n  |  yum install php  |  grep -- "---> Package"
---> Package php.x86_64 0:5.4.16-45.el7 will be installed
---> Package php-cli.x86_64 0:5.4.16-45.el7 will be installed
---> Package php-common.x86_64 0:5.4.16-45.el7 will be installed
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed