Tag Archives: how to get number of packages in repo

How to list YUM repositories in RHEL / CentOS

Learn how to list YUM repositories in RHEL / CentOS. This how-to guide includes various commands along with examples to check details about repositories and their packages in Red Hat systems.

Listing YUM repo in Red Hat systems

YUM (Yellow dog Updater Modified) is a package management tool in Red Hat Linux and its variants like CentOS. In this article, we will walk you through several commands which will be useful for you to get details of YUM repositories in RHEL.

Related read :

Without any further delay, let’s see a list of commands and their example outputs.


List YUM repositories

Run command yum repolist and it will show you all repositories configured under YUM and enabled for use on that server. To view, disabled repositories or all repositories refer below section in this article.

[root@kerneltalks ~]# yum repolist
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
repo id                                                                  repo name                                                                                status
*epel/x86_64                                                             Extra Packages for Enterprise Linux 6 - x86_64                                           12,448
rhui-REGION-client-config-server-7/x86_64                                Red Hat Update Infrastructure 2.0 Client Configuration Server 7                               2
rhui-REGION-rhel-server-releases/7Server/x86_64                          Red Hat Enterprise Linux Server 7 (RPMs)                                                 17,881
rhui-REGION-rhel-server-rh-common/7Server/x86_64                         Red Hat Enterprise Linux Server 7 RH Common (RPMs)                                          231
rsawaroha                                                                rsaw aroha rpms for Fedora/RHEL6+                                                            19
repolist: 30,581

In the above output, you can see the repo list with repo id, repo name, and status. You can see we have EPEL repo configured (repo id epel/x86_64) on the server. Also, last repo rsawaroha we added for installation of xsos tool used to read sosreport.

What is the status column in yum repolist ?

Last column of yum repolist output is status which has numbers in it. You might be wondering, what is the meaning of status numbers in yum repolist?

They are a number of packages included in the respective repository! If you see a number like XXXX+N i.e. followed by + sign and another number then it means that the repository has XXXX number of packages available for installation and N number of packages are excluded.

List details of YUM repositories

Each repositories details like name, id, number of packages available, total size, link details, timestamps, etc can be viewed by using verbose mode. Use -v switch with yum repolist to view repositories details.

[root@kerneltalks ~]# yum -v repolist
Not loading "rhnplugin" plugin, as it is disabled
Loading "amazon-id" plugin
Not loading "product-id" plugin, as it is disabled
Loading "rhui-lb" plugin
Loading "search-disabled-repos" plugin
Not loading "subscription-manager" plugin, as it is disabled
Config time: 0.048
Yum version: 3.4.3
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/supplementary/os
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/extras/os
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/rh-common/debug
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/supplementary/debug
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/rhscl/1/debug
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/rhui-client-config/rhel/server/7/x86_64/os
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/rhscl/1/source/SRPMS
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/rhscl/1/os
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/source/SRPMS
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/extras/debug
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/optional/source/SRPMS
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/optional/debug
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/supplementary/source/SRPMS
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/debug
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/optional/os
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/extras/source/SRPMS
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/rh-common/os
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/rh-common/source/SRPMS
mirrorlist: https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/os
Setting up Package Sacks
pkgsack time: 0.009
Repo-id      : epel/x86_64
Repo-name    : Extra Packages for Enterprise Linux 6 - x86_64
Repo-revision: 1515267354
Repo-updated : Sat Jan  6 19:58:06 2018
Repo-pkgs    : 12,448
Repo-size    : 11 G
Repo-metalink: https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=x86_64
  Updated    : Mon Jan  8 15:45:02 2018
Repo-baseurl : http://mirror.sjc02.svwh.net/fedora-epel/6/x86_64/ (43 more)
Repo-expire  : 21,600 second(s) (last: Mon Jan  8 19:23:12 2018)
  Filter     : read-only:present
Repo-filename: /etc/yum.repos.d/epel.repo

Repo-id      : rhui-REGION-client-config-server-7/x86_64
Repo-name    : Red Hat Update Infrastructure 2.0 Client Configuration Server 7
Repo-revision: 1509723523
Repo-updated : Fri Nov  3 15:38:43 2017
Repo-pkgs    : 2
Repo-size    : 106 k
Repo-mirrors : https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/rhui-client-config/rhel/server/7/x86_64/os
Repo-baseurl : https://rhui2-cds02.ap-south-1.aws.ce.redhat.com/pulp/repos//rhui-client-config/rhel/server/7/x86_64/os/ (1 more)
Repo-expire  : 21,600 second(s) (last: Mon Jan  8 19:23:13 2018)
  Filter     : read-only:present
Repo-filename: /etc/yum.repos.d/redhat-rhui-client-config.repo

Repo-id      : rhui-REGION-rhel-server-releases/7Server/x86_64
Repo-name    : Red Hat Enterprise Linux Server 7 (RPMs)
Repo-revision: 1515106250
Repo-updated : Thu Jan  4 22:50:49 2018
Repo-pkgs    : 17,881
Repo-size    : 24 G
Repo-mirrors : https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/os
Repo-baseurl : https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/repos//content/dist/rhel/rhui/server/7/7Server/x86_64/os/ (1 more)
Repo-expire  : 21,600 second(s) (last: Mon Jan  8 19:23:13 2018)
  Filter     : read-only:present
Repo-filename: /etc/yum.repos.d/redhat-rhui.repo

Repo-id      : rhui-REGION-rhel-server-rh-common/7Server/x86_64
Repo-name    : Red Hat Enterprise Linux Server 7 RH Common (RPMs)
Repo-revision: 1513002956
Repo-updated : Mon Dec 11 14:35:56 2017
Repo-pkgs    : 231
Repo-size    : 4.5 G
Repo-mirrors : https://rhui2-cds01.ap-south-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/7Server/x86_64/rh-common/os
Repo-baseurl : https://rhui2-cds02.ap-south-1.aws.ce.redhat.com/pulp/repos//content/dist/rhel/rhui/server/7/7Server/x86_64/rh-common/os/ (1 more)
Repo-expire  : 21,600 second(s) (last: Mon Jan  8 19:23:13 2018)
  Filter     : read-only:present
Repo-filename: /etc/yum.repos.d/redhat-rhui.repo

Repo-id      : rsawaroha
Repo-name    : rsaw aroha rpms for Fedora/RHEL6+
Repo-revision: 1507778106
Repo-updated : Thu Oct 12 03:15:06 2017
Repo-pkgs    : 19
Repo-size    : 1.4 M
Repo-baseurl : http://people.redhat.com/rsawhill/rpms
Repo-expire  : 21,600 second(s) (last: Mon Jan  8 18:02:10 2018)
  Filter     : read-only:present
Repo-filename: /etc/yum.repos.d/rsawaroha.repo

repolist: 30,581

List enabled YUM repositories

Under YUM you have the choice to enable or disable repositories. During yum operations like installation of packages only enabled repositories are scanned/contacted to perform operations.

To view only enabled repositories in YUM, use yum repolist enabled

[root@kerneltalks ~]# yum repolist enabled
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
repo id                                                                  repo name                                                                                status
*epel/x86_64                                                             Extra Packages for Enterprise Linux 6 - x86_64                                           12,448
rhui-REGION-client-config-server-7/x86_64                                Red Hat Update Infrastructure 2.0 Client Configuration Server 7                               2
rhui-REGION-rhel-server-releases/7Server/x86_64                          Red Hat Enterprise Linux Server 7 (RPMs)                                                 17,881
rhui-REGION-rhel-server-rh-common/7Server/x86_64                         Red Hat Enterprise Linux Server 7 RH Common (RPMs)                                          231
rsawaroha                                                                rsaw aroha rpms for Fedora/RHEL6+                                                            19
repolist: 30,581

List disabled YUM repositories

Similarly, you can list only disabled yum repositories as well. Use yum repolist disabled

[root@kerneltalks ~]# yum repolist disabled
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
repo id                                                                          repo name
epel-debuginfo/x86_64                                                            Extra Packages for Enterprise Linux 6 - x86_64 - Debug
epel-source/x86_64                                                               Extra Packages for Enterprise Linux 6 - x86_64 - Source
epel-testing/x86_64                                                              Extra Packages for Enterprise Linux 6 - Testing - x86_64
epel-testing-debuginfo/x86_64                                                    Extra Packages for Enterprise Linux 6 - Testing - x86_64 - Debug
epel-testing-source/x86_64                                                       Extra Packages for Enterprise Linux 6 - Testing - x86_64 - Source
rhui-REGION-rhel-server-debug-extras/7Server/x86_64                              Red Hat Enterprise Linux Server 7 Extra Debug (Debug RPMs)
rhui-REGION-rhel-server-debug-optional/7Server/x86_64                            Red Hat Enterprise Linux Server 7 Optional Debug (Debug RPMs)
rhui-REGION-rhel-server-debug-rh-common/7Server/x86_64                           Red Hat Enterprise Linux Server 7 RH Common Debug (Debug RPMs)
rhui-REGION-rhel-server-debug-rhscl/7Server/x86_64                               Red Hat Enterprise Linux Server 7 RHSCL Debug (Debug RPMs)
rhui-REGION-rhel-server-debug-supplementary/7Server/x86_64                       Red Hat Enterprise Linux Server 7 Supplementary Debug (Debug RPMs)
rhui-REGION-rhel-server-extras/7Server/x86_64                                    Red Hat Enterprise Linux Server 7 Extra(RPMs)
rhui-REGION-rhel-server-optional/7Server/x86_64                                  Red Hat Enterprise Linux Server 7 Optional (RPMs)
rhui-REGION-rhel-server-releases-debug/7Server/x86_64                            Red Hat Enterprise Linux Server 7 Debug (Debug RPMs)
rhui-REGION-rhel-server-releases-source/7Server/x86_64                           Red Hat Enterprise Linux Server 7 (SRPMs)
rhui-REGION-rhel-server-rhscl/7Server/x86_64                                     Red Hat Enterprise Linux Server 7 RHSCL (RPMs)
rhui-REGION-rhel-server-source-extras/7Server/x86_64                             Red Hat Enterprise Linux Server 7 Extra (SRPMs)
rhui-REGION-rhel-server-source-optional/7Server/x86_64                           Red Hat Enterprise Linux Server 7 Optional (SRPMs)
rhui-REGION-rhel-server-source-rh-common/7Server/x86_64                          Red Hat Enterprise Linux Server 7 RH Common (SRPMs)
rhui-REGION-rhel-server-source-rhscl/7Server/x86_64                              Red Hat Enterprise Linux Server 7 RHSCL (SRPMs)
rhui-REGION-rhel-server-source-supplementary/7Server/x86_64                      Red Hat Enterprise Linux Server 7 Supplementary (SRPMs)
rhui-REGION-rhel-server-supplementary/7Server/x86_64                             Red Hat Enterprise Linux Server 7 Supplementary (RPMs)
repolist: 0

List all configured YUM repositories

List all YUM repositories available on server.

[root@kerneltalks ~]# yum repolist all
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
repo id                                                                  repo name                                                                       status
*epel/x86_64                                                             Extra Packages for Enterprise Linux 6 - x86_64                                  enabled: 12,448
epel-debuginfo/x86_64                                                    Extra Packages for Enterprise Linux 6 - x86_64 - Debug                          disabled
epel-source/x86_64                                                       Extra Packages for Enterprise Linux 6 - x86_64 - Source                         disabled
epel-testing/x86_64                                                      Extra Packages for Enterprise Linux 6 - Testing - x86_64                        disabled
epel-testing-debuginfo/x86_64                                            Extra Packages for Enterprise Linux 6 - Testing - x86_64 - Debug                disabled
epel-testing-source/x86_64                                               Extra Packages for Enterprise Linux 6 - Testing - x86_64 - Source               disabled
rhui-REGION-client-config-server-7/x86_64                                Red Hat Update Infrastructure 2.0 Client Configuration Server 7                 enabled:      2
rhui-REGION-rhel-server-debug-extras/7Server/x86_64                      Red Hat Enterprise Linux Server 7 Extra Debug (Debug RPMs)                      disabled
rhui-REGION-rhel-server-debug-optional/7Server/x86_64                    Red Hat Enterprise Linux Server 7 Optional Debug (Debug RPMs)                   disabled
rhui-REGION-rhel-server-debug-rh-common/7Server/x86_64                   Red Hat Enterprise Linux Server 7 RH Common Debug (Debug RPMs)                  disabled
rhui-REGION-rhel-server-debug-rhscl/7Server/x86_64                       Red Hat Enterprise Linux Server 7 RHSCL Debug (Debug RPMs)                      disabled
rhui-REGION-rhel-server-debug-supplementary/7Server/x86_64               Red Hat Enterprise Linux Server 7 Supplementary Debug (Debug RPMs)              disabled
rhui-REGION-rhel-server-extras/7Server/x86_64                            Red Hat Enterprise Linux Server 7 Extra(RPMs)                                   disabled
rhui-REGION-rhel-server-optional/7Server/x86_64                          Red Hat Enterprise Linux Server 7 Optional (RPMs)                               disabled
rhui-REGION-rhel-server-releases/7Server/x86_64                          Red Hat Enterprise Linux Server 7 (RPMs)                                        enabled: 17,881
rhui-REGION-rhel-server-releases-debug/7Server/x86_64                    Red Hat Enterprise Linux Server 7 Debug (Debug RPMs)                            disabled
rhui-REGION-rhel-server-releases-source/7Server/x86_64                   Red Hat Enterprise Linux Server 7 (SRPMs)                                       disabled
rhui-REGION-rhel-server-rh-common/7Server/x86_64                         Red Hat Enterprise Linux Server 7 RH Common (RPMs)                              enabled:    231
rhui-REGION-rhel-server-rhscl/7Server/x86_64                             Red Hat Enterprise Linux Server 7 RHSCL (RPMs)                                  disabled
rhui-REGION-rhel-server-source-extras/7Server/x86_64                     Red Hat Enterprise Linux Server 7 Extra (SRPMs)                                 disabled
rhui-REGION-rhel-server-source-optional/7Server/x86_64                   Red Hat Enterprise Linux Server 7 Optional (SRPMs)                              disabled
rhui-REGION-rhel-server-source-rh-common/7Server/x86_64                  Red Hat Enterprise Linux Server 7 RH Common (SRPMs)                             disabled
rhui-REGION-rhel-server-source-rhscl/7Server/x86_64                      Red Hat Enterprise Linux Server 7 RHSCL (SRPMs)                                 disabled
rhui-REGION-rhel-server-source-supplementary/7Server/x86_64              Red Hat Enterprise Linux Server 7 Supplementary (SRPMs)                         disabled
rhui-REGION-rhel-server-supplementary/7Server/x86_64                     Red Hat Enterprise Linux Server 7 Supplementary (RPMs)                          disabled
rsawaroha                                                                rsaw aroha rpms for Fedora/RHEL6+                                               enabled:     19
repolist: 30,581

List all available packages in repositories

To list all available packages for installation from all repositories use below command –

[root@kerneltalks ~]# yum list available |more
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Available Packages
2048-cli.x86_64                0.9.1-1.el6      epel
2048-cli-nocurses.x86_64       0.9.1-1.el6      epel
2ping.noarch                   3.2.1-2.el6      epel
389-admin.i686                 1.1.35-1.el6     epel
389-admin.x86_64               1.1.35-1.el6     epel
389-admin-console.noarch       1.1.8-1.el6      epel
389-admin-console-doc.noarch   1.1.8-1.el6      epel
389-adminutil.i686             1.1.19-1.el6     epel
389-adminutil.x86_64           1.1.19-1.el6     epel
389-adminutil-devel.i686       1.1.19-1.el6     epel
389-adminutil-devel.x86_64     1.1.19-1.el6     epel
389-console.noarch             1.1.7-1.el6      epel
389-ds.noarch                  1.2.2-1.el6      epel
389-ds-base.x86_64             1.3.6.1-24.el7_4 rhui-REGION-rhel-server-releases
389-ds-base-libs.x86_64        1.3.6.1-24.el7_4 rhui-REGION-rhel-server-releases
389-ds-console.noarch          1.2.6-1.el6      epel
389-ds-console-doc.noarch      1.2.6-1.el6      epel
389-dsgw.x86_64                1.1.11-1.el6     epel

List packages from the particular repository

yum list available command is useful to list all available packages. If you want to list packages from the particular repository then use below switches –

disablerepo="*" which will exclude all repos from scanning

enablerepo="<repo>" which will include only your desired repo to scan for packages.

[root@kerneltalks ~]# yum --disablerepo="*" --enablerepo="rsawaroha" list available
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Available Packages
Rebooty-inspector.noarch                                                               0.3.0-1                                                                 rsawaroha
pyrite.noarch                                                                          1.0.2-1                                                                 rsawaroha
ravshello.x86_64                                                                       1.35.0-1                                                                rsawaroha
reboot-guard.x86_64                                                                    1.0.1-1                                                                 rsawaroha
rhsecapi.x86_64                                                                        1.0.1-1                                                                 rsawaroha
rhv-manage-hosts.noarch                                                                0.5-1                                                                   rsawaroha
rsar.noarch                                                                            0.1.1-1                                                                 rsawaroha
upvm.x86_64                                                                            0.10.8-1                                                                rsawaroha
valine.noarch                                                                          0.7.4-1                                                                 rsawaroha

In the above command, we listed all packages available under repo name rsawaroha