Our production server is running CentOS release 5.2 (Final).

How do I see/get/list all the dependencies of an already installed RPM package?

For example: SQLite v3.3.6 is already installed in the server. I want to see all the dependencies of this particular package.

Here is the output of the command: rpm -qa |grep sqlite


Also, why it is listing 2 entries of sqlite-3.3.6-2 here?

5 Answers 5

  1. rpm -q --requires somepackagehere

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

  • My OS is 64-bit. Can 2 architecture packages co-exist in the same server? What is the purpose/need of having 2 architecture packages at the same time?
    – Gnanam
    Nov 9, 2010 at 9:17
  • 2
    RH-/Fedora-derived distros support multiarch, whereby multiple packages belonging to "different-yet-similar-enough" archs can coexist in order to allow running executables built for either arch. Nov 9, 2010 at 9:23
  • Unfortunately this requires the package to already be installed locally :\
    – rogerdpack
    Dec 4, 2017 at 18:46
  • @rogerdpack: Well, yes. That's exactly what the question asked for. Dec 4, 2017 at 18:47
  • Yeah unfortunately google sends "everybody straight here" if you google "list RPM dependencies" -- google has scope creeped the question! Regardless, see davey's answer for any followers desiring that functionality.
    – rogerdpack
    Dec 4, 2017 at 18:49

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
  • This command is not working. Am I missing something or there is something missing in your command?
    – Gnanam
    Nov 9, 2010 at 9:14
  • Sorry there was a space missing, the command is yum deplist package.
    – gm3dmo
    Nov 9, 2010 at 9:39
  • 1
    +1 the use of YUM here is nice it's recursive and resolves things like 'perl(COnfig::Tiny)' or 'libc.so(64bit)'. Jan 10, 2014 at 23:14

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.

  • 1
    +1 Your command on listing by architecture-wise is also helpful.
    – Gnanam
    Nov 9, 2010 at 8:58

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
  • Brilliant workaround to the reporting limitations.
    – MarkHu
    May 3, 2019 at 17:08

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .