Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find which rpm package supplies a file I'm looking for?

Tags:

centos

rpm

yum

People also ask

How can I tell which rpm provides a file?

To show what files are in a package, use the rpm command. If you have the file name, you can turn this around and find the related package. The output will provide the package and its version. To just see the package name, use the –queryformat option.

How can I tell which package provides a file?

Using dpkg to find the package that provides a file (only for installed DEB packages - from any source) dpkg can also be used to find out to which package a file belongs to. It can be faster to use than apt-file, because you don't need to install anything, and there's no database to update.

Which command enables you to find the RPM package a specific file belongs to?

Explanation: Use the rpm -qf command to find which RPM package a specific file comes from.

How do I find rpm dependent packages?

deb packages on Ubuntu, you can check dependencies of package using Ubuntu Packages Search. For example I can see dependencies of Wireshark from here. As you can see, dependencies marked by red bullet. If you know all packages your program depends them, you can download and install them using dpkg .


This is an old question, but the current answers are incorrect :)

Use yum whatprovides, with the absolute path to the file you want (which may be wildcarded). For example:

yum whatprovides '*bin/grep'

Returns

grep-2.5.1-55.el5.x86_64 : The GNU versions of grep pattern matching utilities.
Repo        : base
Matched from:
Filename    : /bin/grep

You may prefer the output and speed of the repoquery tool, available in the yum-utils package.

sudo yum install yum-utils
repoquery --whatprovides '*bin/grep'
grep-0:2.5.1-55.el5.x86_64
grep-0:2.5.1-55.el5.x86_64

repoquery can do other queries such as listing package contents, dependencies, reverse-dependencies, etc.


To know the package owning (or providing) an already installed file:

rpm -qf myfilename

The most popular answer is incomplete:

Since this search will generally be performed only for files from installed packages, yum whatprovides is made blisteringly fast by disabling all external repos (the implicit "installed" repo can't be disabled).

yum --disablerepo=* whatprovides <file>

You go to http://www.rpmfind.net and search for the file.

You'll get results for a lot of different distros and versions, but quite likely Fedora and/or CentOS will pop up too and you'll know the package name to install with yum


Well finding the package when you are connected to internet (repository) is easy however when you only have access to RPM packages inside Redhat or Centos DVD (this happens frequently to me when I have to recover a server and I need an application) I recommend using the commands below which is completely independent of internet and repositories. (supposably you have lots of uninstalled packages in a DVD). Let's say you have mounted Package folder in ~/cent_os_dvd and you are looking for a package that provides "semanage" then you can run:

for file in `find ~/cent_os_dvd/ -iname '*.rpm'`;  do rpm -qlp $file |grep '.*bin/semanage';  if [ $? -eq 0 ]; then echo "is in";echo $file  ; fi;  done

Using only the rpm utility, this should work in any OS that has rpm:

rpm -q --whatprovides [file name]

Ref. https://www.thegeekdiary.com/how-to-find-which-rpm-package-provides-a-specific-file-or-library-in-rhel-centos/


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!