Monday, May 19, 2014

Find the Fedora/Red Hat package providing a command

My previous post explains, given a Debian or Ubuntu system, how to find the package that provides a command or file. This post covers the same topic but for Fedora or any modern RPM-based system.

yum provides

Suppose you want to run the mate-system-log command.

$ mate-system-log -bash: mate-system-log: command not found

To identify the package that provides mate-system-log:

$ yum provides mate-system-log Loaded plugins: langpacks, refresh-packagekit mate-system-log-1.6.0-3.fc19.i686 : A log file viewer for the MATE desktop Repo : fedora mate-system-log-1.6.1-1.fc19.i686 : A log file viewer for the MATE desktop Repo : updates

The yum provides command searches the yum cache which contains information about the installed package base as well as what is available in the configured repositories. It matches the input argument against meta-data in the yum cache as a command/feature (mate-system-log), or as a file path. The latter enables you to find the package that provides a file:

$ yum provides /etc/wgetrc Loaded plugins: langpacks, refresh-packagekit wget-1.14-5.fc19.i686 : A utility for retrieving files using the HTTP or FTP protocols Repo : fedora Matched from: Filename : /etc/wgetrc wget-1.14-10.fc19.i686 : A utility for retrieving files using the HTTP or FTP protocols Repo : updates Matched from: Filename : /etc/wgetrc wget-1.14-10.fc19.i686 : A utility for retrieving files using the HTTP or FTP protocols Repo : @updates Matched from: Filename : /etc/wgetrc

yum search

Suppose you want to find the package that provides the Apache Web Server. Unless you know the exact package name, yum provides is not helpful in this case.

$ yum provides apache Loaded plugins: langpacks, refresh-packagekit No matches found

Instead, use yum search. It matches the input keywords against both the package name as well as the package description.

$ yum search Apache Web Server Loaded plugins: langpacks, refresh-packagekit ===== N/S matched: Apache, Web, Server ===== apache-commons-digester.noarch : XML to Java object mapping module apache-rat.noarch : Apache Release Audit Tool (RAT) httpd.i686 : Apache HTTP Server system-config-httpd.noarch : Apache configuration tool <snipped>

From the above output, we can conclude that the package providing Apache is httpd.

No comments: