40

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?

Gnanam
  • 1,439
  • 13
  • 26
  • 32

5 Answers5

38

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
rogerdpack
  • 575
  • 2
  • 8
  • 22
gm3dmo
  • 9,632
  • 1
  • 40
  • 35
35
  1. rpm -q --requires somepackagehere

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

Ignacio Vazquez-Abrams
  • 45,019
  • 5
  • 78
  • 84
  • 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 09 '10 at 09: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 09 '10 at 09:23
  • Unfortunately this requires the package to already be installed locally :\ – rogerdpack Dec 04 '17 at 18:46
  • @rogerdpack: Well, yes. That's exactly what the question asked for. – Ignacio Vazquez-Abrams Dec 04 '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 04 '17 at 18:49
7

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.

Alex
  • 6,477
  • 1
  • 23
  • 32
6

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
Thomas
  • 4,155
  • 5
  • 21
  • 28
Suave-V
  • 61
  • 1
  • 1
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
chicks
  • 3,639
  • 10
  • 26
  • 36
Daeon
  • 31
  • 1