Saturday, March 7, 2009

How do I find which RPM contains a specific file?

The rpm -qf command will provide the name of the RPM package that contains a specific file. For example, to see which rpm contains the file /usr/lib/libdb.so.2, run the following:

# rpm -qf /usr/lib/libdb.so.2
gnome-libs-1.4.1.2.90-34.1


If you are trying to install an RPM package and you are getting an error message saying that a file is missing, RPM may not be able to tell you which package that file is in. Depending on which version of Red Hat Enterprise Linux you are running you can identify the necessary package using either 'yum whatprovides' for Red Hat Enterprise Linux 5 or 'up2date --whatprovides=' for Red Hat Enterprise Linux 4.

# up2date --whatprovides=libdb.so.2
compat-db-4.1.25-9.i386


or

# yum whatprovides */libdb.so
Loaded plugins: rhnplugin
db4-devel-4.3.29-9.fc6.x86_64 : Development files for the Berkeley DB
: (version 4) library.


In the case that you do not have your installations registered to the Red Hat Network and you have no others available, there is a third party web site http://www.rpmfind.net which is a good resource. This website allows you to search by file, and then prints out the name of the package that file is in.

Once you know which package you need to install, you can use up2date in Red Hat Enterprise Linux 4 and older, or yum in Red Hat Enterprise Linux 5 and newer, to install the package from RHN. Packages can also be downloaded from the RHN website at http://rhn.redhat.com.

0 comments: