Home Command line utilities How To Find Dependencies For A Particular Package In CentOS

How To Find Dependencies For A Particular Package In CentOS

By sk
Published: Updated: 83.7K views

This tutorial explains how to find which package requires a certain dependency in CentOS, RHEL, Fedora and scientific Linux. You might ask why we need to find the dependencies. There could be many reasons. If you are a RPM package maintainer you need to be aware of the required dependencies for a particular package. Also, we can omit a particular package while installing multitude of X packages. Say for example, the other day I was trying to install root, a collection of packages provided by EPEL. The entire root-system is unfortunately split into a multitude of 40 packages. To install them, I just ran:

# yum install root-*

But the problem is out of the 40 packages, one particular package requires texlive as a dependency, and it consumed roughly 3 GB of disk space. So, I just want to find out which packages needs textalive as a dependency, so I can simply omit them to save up disk space. Now, you got the answer why we need to find out the dependencies for a particular package. Let us see how to do it with some simple examples.

Find dependencies for a particular package in RHEL, CentOS, Fedora

To find dependencies for any package, you can use the following command.

# yum deplist <package name>

For example, to find the dependencies for sqlite, run:

# yum deplist sqlite

Sample output:

Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * epel: ftp.riken.jp
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
package: sqlite.i686 3.7.17-8.el7
 dependency: /sbin/ldconfig
 provider: glibc.x86_64 2.17-106.el7_2.6
 provider: glibc.i686 2.17-106.el7_2.6
 dependency: libc.so.6(GLIBC_2.4)
 provider: glibc.i686 2.17-106.el7_2.6
 dependency: libdl.so.2
 provider: glibc.i686 2.17-106.el7_2.6
 dependency: libdl.so.2(GLIBC_2.0)
 provider: glibc.i686 2.17-106.el7_2.6
 dependency: libdl.so.2(GLIBC_2.1)
 provider: glibc.i686 2.17-106.el7_2.6
 dependency: libncurses.so.5
 provider: ncurses-libs.i686 5.9-13.20130511.el7
 dependency: libpthread.so.0
 provider: glibc.i686 2.17-106.el7_2.6
 dependency: libpthread.so.0(GLIBC_2.0)
 provider: glibc.i686 2.17-106.el7_2.6
 dependency: libpthread.so.0(GLIBC_2.1)
 provider: glibc.i686 2.17-106.el7_2.6
 dependency: libpthread.so.0(GLIBC_2.2)
 provider: glibc.i686 2.17-106.el7_2.6
 dependency: libreadline.so.6
 provider: readline.i686 6.2-9.el7
 dependency: libtinfo.so.5
 provider: ncurses-libs.i686 5.9-13.20130511.el7
 dependency: rtld(GNU_HASH)
 provider: glibc.x86_64 2.17-106.el7_2.6
 provider: glibc.i686 2.17-106.el7_2.6
package: sqlite.x86_64 3.7.17-8.el7
 dependency: /sbin/ldconfig
 provider: glibc.x86_64 2.17-106.el7_2.6
 provider: glibc.i686 2.17-106.el7_2.6
 dependency: libc.so.6(GLIBC_2.14)(64bit)
 provider: glibc.x86_64 2.17-106.el7_2.6
 dependency: libdl.so.2()(64bit)
 provider: glibc.x86_64 2.17-106.el7_2.6
 dependency: libdl.so.2(GLIBC_2.2.5)(64bit)
 provider: glibc.x86_64 2.17-106.el7_2.6
 dependency: libncurses.so.5()(64bit)
 provider: ncurses-libs.x86_64 5.9-13.20130511.el7
 dependency: libpthread.so.0()(64bit)
 provider: glibc.x86_64 2.17-106.el7_2.6
 dependency: libpthread.so.0(GLIBC_2.2.5)(64bit)
 provider: glibc.x86_64 2.17-106.el7_2.6
 dependency: libreadline.so.6()(64bit)
 provider: readline.x86_64 6.2-9.el7
 dependency: libtinfo.so.5()(64bit)
 provider: ncurses-libs.x86_64 5.9-13.20130511.el7
 dependency: rtld(GNU_HASH)
 provider: glibc.x86_64 2.17-106.el7_2.6
 provider: glibc.i686 2.17-106.el7_2.6

find the dependencies for sqlite package

As you see in the above output, sqllite requires many dependencies like glibc, libreadline, ncurses etc.

In case the above command doesn't work by any chance, you can use repoquery command:

To use this command, you need to install yum-utils package.

Run the following command to install it.

# sudo yum install yum-utils

Or,

# sudo dnf install yum-utils

Then, list out the dependencies for a package as shown below.

# repoquery --requires --resolve <package>

Example:

# repoquery --requires --resolve sqlite

Sample output:

glibc-0:2.17-157.el7.i686
readline-0:6.2-9.el7.i686
ncurses-libs-0:5.9-13.20130511.el7.i686
glibc-0:2.17-157.el7_3.1.x86_64

find the dependencies for sqlite

This command will work either the package is installed or not in your system.

If you want to know where a particular package comes from, just run:

# yum provides sqlite

Sample output:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * epel: kodeterbuka.beritagar.id
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
sqlite-3.7.17-8.el7.i686 : Library that implements an embeddable SQL database
 : engine
Repo : base

sqlite-3.7.17-8.el7.x86_64 : Library that implements an embeddable SQL database
 : engine
Repo : base

sqlite-3.7.17-8.el7.x86_64 : Library that implements an embeddable SQL database
 : engine
Repo : @base

find where sqlite package comes from

As you see above, the sqlite package is from base repository.

Hope this helps.

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

1 comment

Eido August 23, 2019 - 4:38 pm

Helpful article, much thanks.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More