Red Hat Enterprise Linux (RHEL), Fedora, CentOS and Scientific Linux allows administrators to add and enable multiple repositories (repos) to install software packages that are not included in the default base and updates repositories. Over time, the software packages that are installed can grow to quite a big list, and thus it’s nearly impossible to remember the source repo of all install packaged, especially when a package is available from multiple repos.

Here’s a few ways which you can use to find out the repo which installed the software package.

Yum List Installed
“list yum installed” is a popular command to list all installed packages on the system. In the newer version of YUM, the repository which installed the package is listed together. Some repos also append a unique “repo” tag to the release. With this info, we can grep all packages installed by a particular repo:

yum list installed | grep package_name

Or,

yum list installed | grep repo_name

For example, to look for all packages installed by EPEL repo:

yum list installed | grep epel

You can also specify the name of the package to search for instead of repo name.

The downsize of this method is that packages from other repos may also be listed if they have something that matches the string of repo been search. For example, command above returns packages from extras repo, which we installed the epel-release package, and from Software Collection repo, which has “epel” string in their release.

$ sudo yum list installed | grep epel
GeoIP.x86_64          1.5.1-5.el6       @epel
awstats.noarch        7.0-3.el6         @epel
epel-release.noarch   6-8               @extras
libmcrypt.x86_64      2.5.8-9.el6       @epel
mod_fcgid.x86_64      2.3.9-1.el6       @epel
php-mcrypt.x86_64     5.3.3-3.el6       @epel
php55.x86_64          1.1-6.el6         @rhscl-php55-epel-6-x86_64
php55-php-cli.x86_64  5.5.6-13.el6      @rhscl-php55-epel-6-x86_64
                      5.5.6-13.el6      @rhscl-php55-epel-6-x86_64
php55-php-gd.x86_64   5.5.6-13.el6      @rhscl-php55-epel-6-x86_64
php55-php-gmp.x86_64  5.5.6-13.el6      @rhscl-php55-epel-6-x86_64
php55-php-imap.x86_64 5.5.6-13.el6      @rhscl-php55-epel-6-x86_64
                      5.5.6-13.el6      @rhscl-php55-epel-6-x86_64
                      5.5.6-1.el6       @remi-php55more-epel-6-x86_64
                      5.5.6-13.el6      @rhscl-php55-epel-6-x86_64
php55-php-odbc.x86_64 5.5.6-13.el6      @rhscl-php55-epel-6-x86_64
php55-php-pdo.x86_64  5.5.6-13.el6      @rhscl-php55-epel-6-x86_64
php55-php-pear.noarch 1:1.9.4-10.el6    @rhscl-php55-epel-6-x86_64
                      1.3.5-1.el6       @rhscl-php55-epel-6-x86_64
                      5.5.6-13.el6      @rhscl-php55-epel-6-x86_64
php55-php-xml.x86_64  5.5.6-13.el6      @rhscl-php55-epel-6-x86_64
                      5.5.6-13.el6      @rhscl-php55-epel-6-x86_64
php55-runtime.x86_64  1.1-6.el6         @rhscl-php55-epel-6-x86_64
proftpd.x86_64        1.3.3g-4.el6      @epel
remi-php55more-epel-6-x86_64.noarch
                      1-2               @/remi-php55more-epel-6-x86_64.noarch
rhscl-php55-epel-6-x86_64.noarch
                      1-2               @/rhscl-php55-epel-6-x86_64.noarch
scponly.x86_64        4.8-15.el6        @epel

Yum List Installed from a Repo

In addition, this method also does not work if the repo that you want to search for does not have any distinctive or unique characteristics, or does not display itself in the listing.

Yumdb Search From_Repo
The foolproof way to get information about the repo which installed a given package is by using yumdb, which saves all information when the package was installed.

yumdb search from_repo repo_name

For example,

yumdb search from_repo epel

Result:

[root@server etc]# yumdb search from_repo epel
Loaded plugins: fastestmirror
GeoIP-1.5.1-5.el6.x86_64
     from_repo = epel

awstats-7.0-3.el6.noarch
     from_repo = epel

libmcrypt-2.5.8-9.el6.x86_64
     from_repo = epel

mod_fcgid-2.3.9-1.el6.x86_64
     from_repo = epel

php-mcrypt-5.3.3-3.el6.x86_64
     from_repo = epel

proftpd-1.3.3g-4.el6.x86_64
     from_repo = epel

scponly-4.8-15.el6.x86_64
     from_repo = epel

Yumdb Search From_Depo

Find-Repos-of-Install
Similar to “yum list installed”, “find-repos-of-install” command lists all the installed packages with their source repo. You need to pipe to grep to get information on a particular repo or package of your interest. And similarly, it may return unneeded repo or package which contains the same keyword.

find-repos-of-install | grep package_name

Or,

find-repos-of-install | grep repo_name

To use “find-repos-of-install”, you need to have yum-utils package installed.

RepoQuery
Another utility which can be used to identify the repo which responsible to install a package is “repoquery”, with the help of “grep”:

repoquery -a --qf "%-20{repoid} %{name}" | grep package_name

Or,

repoquery -a --qf "%-20{repoid} %{name}" | grep repo_name

Repoquery lists all packages available from enabled repositories. So you may need to spend more time to find out what you want from a long list of output. And it may also return unneeded repo or package which contains the same keyword.

To use “repoquery”, you need to have yum-utils package installed.