How to check a list of installed packages from a specific repository in Linux

If you want to check the list of packages installed from a specific repository, you are in the right place to do it.

Why do we need this detail? This may help you to isolate a list of installed packages based on the repository.

You can check whether it comes from the official repository of distribution or whether they are from the PPA or they are from other resources.

You may want to know what packages comes from third-party repositories do to prevent any damage to your system.

Many third-party repositories and PPAs are available for Linux.

Due to some limitations of these repositories, a collection of packages not available in the distribution official repository is included.

This enables the administrator to easily install some important packages that are not available in the distribution official repository.

Installing a third-party repository in a production system is not advisable because it may not be properly maintained by the repository maintainer for many reasons.

So you have to decide whether you want to install it or not. We can rely on some of the third party repositories that are well maintained and recommended by Linux distributions such as the EPEL repository, Copr, so on.

If you want to view a list of installed packages from a specific repo, use the following commands based on your distributions.

Below is a list of major repositories and their details commonly used by many Linux administrators.

  • CentOS: CentOS has several community recognized repositories that are usually well-maintained and provide a significant number of additional packages for CentOS.
  • Fedora: The RPMfusion repository and the Remi repository are commonly used by most Fedora users.
  • Arch Linux: Arch Linux community repository contains packages that have been adopted by Trusted Users from the Arch User Repository.
  • openSUSE: Packman repo is a community repository that provides a variety of packages for SUSE and openSUSE, not just for multimedia related applications and libraries.
  • Ubuntu: Personal Package Archives (PBAs) are a kind of repository. Developers develop their software for distribution. You can find this information on the PPA Launchpad page.

What is Repository?

A software repository is a central location for storing software packages for a specific application. All Linux distributions maintain their own repositories, and they allow users to retrieve and install packages on their system.

Each vendor provided a unique package management tool to manage repositories such as search, install, update, upgrade, and delete.

Most Linux distributions come as freeware except RHEL and SUSE. You need to buy subscriptions to access their repositories.

1) How to Check the List of Installed Packages from a Specific Repository on RHEL/CentOS Systems

This can be done in a number of ways on Red Hat and CentOS systems. Here we give you all possible options and you can choose what suits you best.

Method-1: How to Check the List of Installed Packages from a Specific Repository on RHEL/CentOS Systems Using the Yum Command

You can see these details using the yum command as follows.

YUM stands for Yellowdog Updater, Modified is an open-source command-line front-end package-management utility for RPM based systems such as Red Hat Enterprise Linux (RHEL) and CentOS.

Yum is the primary tool for getting, installing, deleting, querying, and managing RPM packages from distribution repositories, as well as other third-party repositories.

# yum list installed | grep @epel

apachetop.x86_64                      0.15.6-1.el7                    @epel
aria2.x86_64                          1.18.10-2.el7.1                 @epel
atop.x86_64                           2.3.0-8.el7                     @epel
axel.x86_64                           2.4-9.el7                       @epel
epel-release.noarch                   7-11                            @epel
lighttpd.x86_64                       1.4.50-1.el7                    @epel

Alternatively, you can use the yum command with another option to get the same details as above.

# yum repo-pkgs epel list installed

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * epel: epel.mirror.constant.com
Installed Packages
apachetop.x86_64                                                                              0.15.6-1.el7                                                                              @epel
aria2.x86_64                                                                                  1.18.10-2.el7.1                                                                           @epel
atop.x86_64                                                                                   2.3.0-8.el7                                                                               @epel
axel.x86_64                                                                                   2.4-9.el7                                                                                 @epel
epel-release.noarch                                                                           7-11                                                                                      @epel
lighttpd.x86_64                                                                               1.4.50-1.el7                                                                              @epel

Method-2: How to Check the List of Installed Packages from a Specific Repository on RHEL/CentOS Systems Using the Yumdb Command

This command is used to query and alter the yum database, which is a simple key value store used in conjunction with the rpm database. Any installed package can have arbitrary data in the yum database.

# yumdb search from_repo epel* |egrep -v '(from_repo|^$)'

Loaded plugins: fastestmirror
apachetop-0.15.6-1.el7.x86_64
aria2-1.18.10-2.el7.1.x86_64
atop-2.3.0-8.el7.x86_64
axel-2.4-9.el7.x86_64
epel-release-7-11.noarch
lighttpd-1.4.50-1.el7.x86_64

Method-3: How to Check the List of Installed Packages from a Specific Repository on RHEL/CentOS Systems Using the Repoquery Command

repoquery is a program for querying information from YUM repositories similarly to rpm queries.

# repoquery -a --installed --qf "%{ui_from_repo} %{name}" | grep '^@epel'

@epel apachetop
@epel aria2
@epel atop
@epel axel
@epel epel-release
@epel lighttpd

2) How to Check the List of Installed Packages from a Specific Repository in Fedora, CentOS 8 and RHEL 8 Systems

DNF stands for “Dandified Yum”. This is the next generation of yum package manager (Fork of Yum). The DNF command uses the libsolv, hawkey, ibrepo and libcomps libraries to manage RPM packages.

It was introduced in Fedora 18, which has been the default package manager since Fedora 22.

DNF is a software package manager that installs, updates, and removes packages on RPM-based Linux distributions. It automatically computes dependencies and determines the actions required to install packages.

# dnf list installed | grep @updates

NetworkManager.x86_64                       1:1.12.4-2.fc29                     @updates
NetworkManager-adsl.x86_64                  1:1.12.4-2.fc29                     @updates
NetworkManager-bluetooth.x86_64             1:1.12.4-2.fc29                     @updates
NetworkManager-libnm.x86_64                 1:1.12.4-2.fc29                     @updates
NetworkManager-libreswan.x86_64             1.2.10-1.fc29                       @updates
NetworkManager-libreswan-gnome.x86_64       1.2.10-1.fc29                       @updates
NetworkManager-openvpn.x86_64               1:1.8.8-1.fc29                      @updates
NetworkManager-openvpn-gnome.x86_64         1:1.8.8-1.fc29                      @updates
NetworkManager-ovs.x86_64                   1:1.12.4-2.fc29                     @updates
NetworkManager-ppp.x86_64                   1:1.12.4-2.fc29                     @updates
.
.

Alternatively, you can use the yum command with another option to get the same details as above.

# dnf repo-pkgs updates list installed
Installed Packages
NetworkManager.x86_64                   1:1.12.4-2.fc29                 @updates
NetworkManager-adsl.x86_64              1:1.12.4-2.fc29                 @updates
NetworkManager-bluetooth.x86_64         1:1.12.4-2.fc29                 @updates
NetworkManager-libnm.x86_64             1:1.12.4-2.fc29                 @updates
NetworkManager-libreswan.x86_64         1.2.10-1.fc29                   @updates
NetworkManager-libreswan-gnome.x86_64   1.2.10-1.fc29                   @updates
NetworkManager-openvpn.x86_64           1:1.8.8-1.fc29                  @updates
NetworkManager-openvpn-gnome.x86_64     1:1.8.8-1.fc29                  @updates
NetworkManager-ovs.x86_64               1:1.12.4-2.fc29                 @updates
.
.

3) How to Check the List of Installed Packages from a Specific Repository on SUSE and openSUSE Systems

Zypper is a command-line package manager that uses libzypp. The Zypper command provides functions such as repository access, dependency resolution, and package installation.

# zypper search -ir "Update Repository (Non-Oss)"
Loading repository data...
Reading installed packages...

S  | Name                       | Summary                                           | Type  
---+----------------------------+---------------------------------------------------+--------
i  | gstreamer-0_10-fluendo-mp3 | GStreamer plug-in from Fluendo for MP3 support    | package
i+ | openSUSE-2016-615          | Test-update for openSUSE Leap 42.2 Non Free       | patch 
i+ | openSUSE-2017-724          | Security update for unrar                         | patch 
i  | unrar                      | A program to extract, test, and view RAR archives | package

Alternatively, you can use the repo id instead of the repo name as follows.

# zypper search -ir 2
Loading repository data...
Reading installed packages...

S  | Name                       | Summary                                           | Type  
---+----------------------------+---------------------------------------------------+--------
i  | gstreamer-0_10-fluendo-mp3 | GStreamer plug-in from Fluendo for MP3 support    | package
i+ | openSUSE-2016-615          | Test-update for openSUSE Leap 42.2 Non Free       | patch 
i+ | openSUSE-2017-724          | Security update for unrar                         | patch 
i  | unrar                      | A program to extract, test, and view RAR archives | package

4) How to Check the List of Installed Packages from a Specific Repository on Arch Linux Based Systems

Pacman stands for package manager utility. pacman command is a simple command-line utility to install, build, remove and manage Arch Linux packages. Pacman uses libalpm (Arch Linux Package Management (ALPM) library) as a back-end to perform all the actions.

$ paclist community
acpi 1.7-2
acpid 2.0.30-1
adapta-maia-theme 3.94.0.149-1
android-tools 9.0.0_r3-1
blueman 2.0.6-1
brotli 1.0.7-1
.
.
ufw 0.35-5
unace 2.5-10
usb_modeswitch 2.5.2-1
viewnior 1.7-1
wallpapers-2018 1.0-1
xcursor-breeze 5.11.5-1
xcursor-simpleandsoft 0.2-8
xcursor-vanilla-dmz-aa 0.4.5-1
xfce4-whiskermenu-plugin-gtk3 2.3.0-1
zeromq 4.2.5-1

5) How to Check the List of Installed Packages from a Specific Repository on Debian Based Systems

I haven’t found the right command for Debian-based systems, and you can do this by filtering values from the “/var/lib/apt/lists/” directory.

If you want to know the list of repositories installed on your system, use the following command.

$ ls -lh /var/lib/apt/lists/ | uniq
total 370M
-rw-r--r-- 1 root root  10K Oct 26 10:53 archive.canonical.com_ubuntu_dists_bionic_InRelease
-rw-r--r-- 1 root root 6.4K Oct 26 10:53 archive.canonical.com_ubuntu_dists_bionic_partner_binary-amd64_Packages
-rw-r--r-- 1 root root 6.4K Oct 26 10:53 archive.canonical.com_ubuntu_dists_bionic_partner_binary-i386_Packages
-rw-r--r-- 1 root root 3.2K Jun 12 21:19 archive.canonical.com_ubuntu_dists_bionic_partner_i18n_Translation-en
drwxr-xr-x 2 _apt root 4.0K Jul 25 08:44 auxfiles
-rw-r--r-- 1 root root 3.7K Oct 16 15:13 download.virtualbox.org_virtualbox_debian_dists_bionic_contrib_binary-amd64_Packages
-rw-r--r-- 1 root root 7.2K Oct 16 15:13 download.virtualbox.org_virtualbox_debian_dists_bionic_contrib_Contents-amd64.lz4
-rw-r--r-- 1 root root 4.4K Oct 16 15:13 download.virtualbox.org_virtualbox_debian_dists_bionic_InRelease
-rw-r--r-- 1 root root   34 Mar 19  2018 download.virtualbox.org_virtualbox_debian_dists_bionic_non-free_Contents-amd64.lz4
-rw-r--r-- 1 root root 6.4K Sep 21 09:42 in.archive.ubuntu.com_ubuntu_dists_bionic-backports_Contents-amd64.lz4
-rw-r--r-- 1 root root 6.4K Sep 21 09:42 in.archive.ubuntu.com_ubuntu_dists_bionic-backports_Contents-i386.lz4
-rw-r--r-- 1 root root  73K Nov  6 11:16 in.archive.ubuntu.com_ubuntu_dists_bionic-backports_InRelease
.
.
-rw-r--r-- 1 root root   29 May 11 06:39 security.ubuntu.com_ubuntu_dists_bionic-security_main_dep11_icons-64x64.tar.gz
-rw-r--r-- 1 root root 747K Nov  5 23:57 security.ubuntu.com_ubuntu_dists_bionic-security_main_i18n_Translation-en
-rw-r--r-- 1 root root 2.8K Oct  9 22:37 security.ubuntu.com_ubuntu_dists_bionic-security_multiverse_binary-amd64_Packages
-rw-r--r-- 1 root root 3.7K Oct  9 22:37 security.ubuntu.com_ubuntu_dists_bionic-security_multiverse_binary-i386_Packages
-rw-r--r-- 1 root root 1.8K Jul 24 23:06 security.ubuntu.com_ubuntu_dists_bionic-security_multiverse_i18n_Translation-en
-rw-r--r-- 1 root root 519K Nov  5 20:12 security.ubuntu.com_ubuntu_dists_bionic-security_universe_binary-amd64_Packages
-rw-r--r-- 1 root root 517K Nov  5 20:12 security.ubuntu.com_ubuntu_dists_bionic-security_universe_binary-i386_Packages
-rw-r--r-- 1 root root  11K Nov  6 05:36 security.ubuntu.com_ubuntu_dists_bionic-security_universe_dep11_Components-amd64.yml.gz
-rw-r--r-- 1 root root 8.9K Nov  6 05:36 security.ubuntu.com_ubuntu_dists_bionic-security_universe_dep11_icons-48x48.tar.gz
-rw-r--r-- 1 root root  16K Nov  6 05:36 security.ubuntu.com_ubuntu_dists_bionic-security_universe_dep11_icons-64x64.tar.gz
-rw-r--r-- 1 root root 315K Nov  5 20:12 security.ubuntu.com_ubuntu_dists_bionic-security_universe_i18n_Translation-en

Use the following format to get a list of installed packages from the security.ubuntu.com repository.

$ grep Package /var/lib/apt/lists/security.ubuntu.com_*_Packages | awk '{print $2;}'
amd64-microcode
apache2
apache2-bin
apache2-data
apache2-dbg
apache2-dev
.
.
znc
znc-dev
znc-perl
znc-python
znc-tcl
zsh-static
zziplib-bin

The security repository contains multiple branches, such as main, multivers, and universe, and if you want to list installed packages from a specific branche repository, use the following format.

$ grep Package /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_bionic-security_universe*_Packages | awk '{print $2;}'
ant
ant-doc
ant-optional
apache2-suexec-custom
apache2-suexec-pristine
apparmor-easyprof
apport-kde
apport-noui
apport-valgrind
apt-transport-https
.
.
xul-ext-gdata-provider
xul-ext-lightning
xvfb
znc
znc-dev
znc-perl
znc-python
znc-tcl
zsh-static
zziplib-bin

This is another example, which lists installed packages from the ppa.launchpad.net repository.

$ grep Package /var/lib/apt/lists/ppa.launchpad.net_*_Packages | awk '{print $2;}'
notepadqq
notepadqq-gtk
notepadqq-common
notepadqq
notepadqq-gtk
notepadqq-common
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle
numix-icon-theme-square
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle
numix-icon-theme-square

About Prakash Subramanian

Prakash Subramanian is a Linux lover and has 3.5+ years of experience in linux server administration with major Linux distribution such as (RHEL, CentOS, Ubuntu). He is currently working as a Senior L2 Linux Server administrator.

View all posts by Prakash Subramanian

Leave a Reply

Your email address will not be published. Required fields are marked *