36

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

python-sqlite-1.1.7-1.2.1
sqlite-3.3.6-2
sqlite-3.3.6-2

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

28
  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 '10 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. – Ignacio Vazquez-Abrams Nov 9 '10 at 9:23
  • Unfortunately this requires the package to already be installed locally :\ – rogerdpack Dec 4 '17 at 18:46
  • @rogerdpack: Well, yes. That's exactly what the question asked for. – Ignacio Vazquez-Abrams Dec 4 '17 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 '17 at 18:49
34

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 '10 at 9:14
  • Sorry there was a space missing, the command is yum deplist package. – davey Nov 9 '10 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)'. – djhaskin987 Jan 10 '14 at 23:14
6

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 '10 at 8:58
3

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
3

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 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.