92

apt-cache show <package> shows also it's dependencies.

yum info <package> does not show dependencies, but it obviously know them.

How to ask yum for dependencies of specified package?

5 Answers 5

102

yum doesn't have that capability. Use the repoquery tool from the yum-utils package instead.

repoquery --requires <package>

OR to also see which additional RPM packages are needed to satisfy the dependencies, use --resolve

repoquery --requires --resolve <package>
7
  • 1
    How would I do the same if I have a local rpm file? Apr 23, 2012 at 15:38
  • Maybe extract the control file from rpm package and look into it?
    – Vi.
    Nov 26, 2012 at 10:56
  • 14
    If you have it downloaded then you use rpm -qp --requires <package file>. Nov 26, 2012 at 12:27
  • If you use RHN, you need to add --plugins to the call to repoquery. See stackoverflow.com/questions/15433843/…
    – nlu
    Dec 21, 2016 at 11:39
  • What does --resolve actually do? Running repoquery --requires --resolve on a package that is already installed should return an empty list right, since all dependencies are already satisfied? When I tried it on a package that is already installed, I got a few listed, including itself (all of these are already installed).
    – haridsv
    Dec 7, 2018 at 9:25
61

Use deplist command,

yum deplist <package>

From yum's manual:

Produces a list of all dependencies and what packages provide those dependencies for the given packages.

Update for dnf

To do the same thing with dnf, we can do

dnf repoquery --requires <package>

As man yum2dnf said:

Alternative to Yum deplist command to find out dependencies of the package is dnf repoquery --requires using repoquery plugin.

1
  • 6
    Unfortunately, this will return a list of all possible providers of each dependency, which can end up returning many hundreds or thousands of lines, instead of a simple list of the names of dependent packages.
    – deesto
    Aug 8, 2013 at 20:00
15

If you have a local RPM, you can get a list of dependencies via:

rpm -qpR mediawiki-1.4rc1-4.i586.rpm
2
  • 2
    Works for URLs too.
    – Asclepius
    Aug 27, 2014 at 22:19
  • if you ommit -q then you can query your configured repos: rpm -qR graphviz lists all the dependencies for me May 4, 2015 at 13:12
4

If you need the list of packages needed, use:

dnf repoquery --requires --resolve`

In the case of firefox, by running:

sudo dnf repoquery --requires --resolve firefox

I've got the ouput: Last metadata expiration check: 0:00:00 ago on Wed 13 Dec 2017 21:41:47 GMT. atk-0:2.26.1-1.fc27.x86_64 bash-0:4.4.12-12.fc27.x86_64 cairo-0:1.15.8-1.fc27.x86_64 cairo-gobject-0:1.15.8-1.fc27.x86_64 dbus-glib-0:0.108-4.fc27.x86_64 dbus-libs-1:1.12.0-1.fc27.x86_64 fontconfig-0:2.12.6-4.fc27.x86_64 freetype-0:2.8-6.fc27.x86_64 freetype-freeworld-0:2.8-4.fc27.x86_64 gdk-pixbuf2-0:2.36.11-1.fc27.x86_64 glib2-0:2.54.2-1.fc27.x86_64 glibc-0:2.26-16.fc27.i686 glibc-0:2.26-16.fc27.x86_64 gtk2-0:2.24.31-6.fc27.x86_64 gtk3-0:3.22.26-1.fc27.x86_64 hunspell-0:1.5.4-4.fc27.x86_64 libX11-0:1.6.5-4.fc27.x86_64 libX11-xcb-0:1.6.5-4.fc27.x86_64 libXcomposite-0:0.4.4-11.fc27.x86_64 libXdamage-0:1.1.4-11.fc27.x86_64 libXext-0:1.3.3-7.fc27.x86_64 libXfixes-0:5.0.3-4.fc27.x86_64 libXrender-0:0.9.10-4.fc27.x86_64 libXt-0:1.1.5-6.fc27.x86_64 libffi-0:3.1-14.fc27.x86_64 libgcc-0:7.2.1-2.fc27.x86_64 libjpeg-turbo-0:1.5.1-4.fc27.x86_64 libstdc++-0:7.2.1-2.fc27.x86_64 libvpx-0:1.6.1-4.fc27.x86_64 libxcb-0:1.12-5.fc27.x86_64 mozilla-filesystem-0:1.9-17.fc27.x86_64 nspr-0:4.17.0-1.fc27.i686 nspr-0:4.17.0-1.fc27.x86_64 nss-0:3.34.0-1.0.fc27.i686 nss-0:3.34.0-1.0.fc27.x86_64 nss-util-0:3.34.0-1.0.fc27.x86_64 p11-kit-trust-0:0.23.8-1.fc27.i686 p11-kit-trust-0:0.23.9-2.fc27.x86_64 pango-0:1.40.14-1.fc27.x86_64 startup-notification-0:0.12-14.fc27.x86_64 u2f-hidraw-policy-0:1.0.2-5.fc27.x86_64 zlib-0:1.2.11-4.fc27.x86_64

1

If you want to install a package and it's dependencies via yum, try the localinstall option instead if install. The localinstall install a package and finds any dependencies and downloads them:

$ yum -y localinstall <package>

I am no yum guru but this works fine for me, makes it easy to install including dependencies :-)

You must log in to answer this question.

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