Contents...
When you need to make another server which has the very same set up as any current server X, you have to discover what bundles or packages have been introduced on server X. Likewise when you are trying to relocate your old Linux server to a newly introduced fresh OS release, you have to monitor already installed packages list. In different circumstances, you may simply need to know what packages has been installed on server from a specific third party repository
In this article I will provide you four method to list all installed packages on CentOS or RHEL system.
Method One
Using RPM command, it is easiest way to list all installed packages on CentOS or RHEL via this command. Following command queries all installed packages on your system.
# rpm -qa basesystem-10.0-4.el6.noarch libXcomposite-0.4.3-4.el6.x86_64 libcroco-0.6.2-5.el6.x86_64 eggdbus-0.6-3.el6.x86_64 bzip2-libs-1.0.5-7.el6_0.x86_64 zlib-devel-1.2.3-29.el6.x86_64 cyrus-sasl-2.1.23-15.el6_6.2.x86_64 mod_fcgid-2.3.9-1.el6.x86_64 libICE-devel-1.0.6-1.el6.x86_64 libXau-devel-1.0.6-4.el6.x86_64 keyutils-1.4-5.el6.x86_64 sed-4.2.1-10.el6.x86_64 libpng-1.2.49-2.el6_7.x86_64 libicu-devel-4.2.1-14.el6.x86_64 python-setuptools-0.6.10-3.el6.noarch fipscheck-lib-1.2.0-7.el6.x86_64 kernel-2.6.32-642.15.1.el6.x86_64 sqlite-devel-3.6.20-1.el6_7.2.x86_64 libtiff-devel-3.9.4-21.el6_8.x86_64 libtasn1-2.3-6.el6_5.x86_64 MySQL-python-1.2.3-0.3.c1.1.el6.x86_64 shared-mime-info-0.70-6.el6.x86_64 ius-release-1.0-15.ius.centos6.noarch libedit-2.11-4.20080712cvs.1.el6.x86_64 nss-softokn-freebl-3.14.3-23.3.el6_8.x86_64 dbus-libs-1.2.24-8.el6_6.x86_64 libgpg-error-1.7-4.el6.x86_64 yum-utils-1.1.30-40.el6.noarch chkconfig-1.3.49.5-1.el6.x86_64 php-pecl-jsonc-1.3.10-2.el6.remi.5.6.x86_64 pkgconfig-0.23-9.1.el6.x86_64 memcached-1.4.25-1.el6.remi.x86_64 php-pdo-5.6.31-1.el6.remi.x86_64 slang-2.2.1-1.el6.x86_64 gpg-pubkey-cf4c4ff9-4d5efb53 xz-lzma-compat-4.999.9-0.5.beta.20091007git.el6.x86_64 ...... .....
The rpm command does not provides the notion of repository. If you want to get a list of packages installed from a particular repository, rpm cannot help you.
Method Two
Yum comand also list all the installed packages on your system like below.
# yum list installed Loaded plugins: fastestmirror, replace Loading mirror speeds from cached hostfile * epel: mirror.oss.ou.edu * ius: mirror.team-cymru.org * remi-php56: repo1.dal.innoscale.net * remi-safe: repo1.dal.innoscale.net * rpmforge: mirror.us.leaseweb.net Installed Packages ConsoleKit.x86_64 0.4.1-6.el6 @base ConsoleKit-libs.x86_64 0.4.1-6.el6 @base GConf2.x86_64 2.28.0-7.el6 @base GeoIP.x86_64 1.6.5-1.el6 @epel GeoIP-GeoLite-data.noarch 2017.07-1.el6 @epel GeoIP-GeoLite-data-extra.noarch 2017.07-1.el6 @epel ImageMagick.x86_64 6.7.2.7-6.el6 @base ImageMagick-devel.x86_64 6.7.2.7-6.el6 @base ImageMagick6-libs.x86_64 6.9.9.20-1.el6.remi @remi-safe MAKEDEV.x86_64 3.24-6.el6 installed MariaDB-client.x86_64 10.0.32-1.el6 @mariadb MariaDB-common.x86_64 10.0.32-1.el6 @mariadb MariaDB-compat.x86_64 10.0.32-1.el6 @mariadb MariaDB-shared.x86_64 10.0.32-1.el6 @mariadb MySQL-python.x86_64 1.2.3-0.3.c1.1.el6 @base ORBit2.x86_64 2.14.17-6.el6_8 @updates OpenEXR-libs.x86_64 1.6.1-8.1.el6 @base apr.x86_64 1.3.9-5.el6_2 @base apr-util.x86_64 1.3.9-3.el6_0.1 installed apr-util-ldap.x86_64 1.3.9-3.el6_0.1 installed aspell.x86_64 12:0.60.6-12.el6 installed atk.x86_64 1.30.0-1.el6 @base audit-libs.x86_64 2.4.5-6.el6 @base audit-libs-python.x86_64 2.4.5-6.el6 @base authconfig.x86_64 6.1.12-23.el6 @base autoconf.noarch 2.63-5.1.el6 @base automake.noarch 1.11.1-4.el6 @base avahi-libs.x86_64 0.6.25-17.el6 @base basesystem.noarch 10.0-4.el6 installed bash.x86_64 4.1.2-48.el6 @base bind.x86_64 32:9.8.2-0.62.rc1.el6_9.4 @updates bind-libs.x86_64 32:9.8.2-0.62.rc1.el6_9.4 @updates binutils.x86_64 2.20.51.0.2-5.47.el6_9.1 @updates blackfire-agent.x86_64 1.14.1-1 @blackfire blackfire-php.x86_64 1.18.0-1 @blackfire boost-filesystem.x86_64 1.41.0-28.el6 @base boost-iostreams.x86_64 1.41.0-28.el6 @base boost-program-options.x86_64 1.41.0-28.el6 @base boost-system.x86_64 1.41.0-28.el6 @base boost-thread.x86_64 1.41.0-28.el6 @base bzip2.x86_64 1.0.5-7.el6_0 installed bzip2-devel.x86_64 1.0.5-7.el6_0 @base bzip2-libs.i686 1.0.5-7.el6_0 installed bzip2-libs.x86_64 1.0.5-7.el6_0 installed ca-certificates.noarch 2017.2.14-65.0.1.el6_9 @updates cairo.x86_64 1.8.8-6.el6_6 @base centos-indexhtml.noarch 6-2.el6.centos @base centos-release.x86_64 6-9.el6.12.3 @base centos-release-scl-rh.noarch 2-3.el6.centos @extras checkpolicy.x86_64 2.0.22-1.el6 @base chkconfig.x86_64 1.3.49.5-1.el6 @base cloog-ppl.x86_64 0.15.7-1.2.el6 @base compat-mysql51.x86_64 5.1.54-1.el6.remi @remi coreutils.x86_64 8.4-46.el6 @base coreutils-libs.x86_64 8.4-46.el6 @base cpio.x86_64 2.10-13.el6 @base cpp.x86_64 4.4.7-18.el6 @base cracklib.x86_64 2.8.16-4.el6 installed cracklib-dicts.x86_64 2.8.16-4.el6 installed cronie.x86_64 1.4.4-16.el6_8.2 @updates cronie-anacron.x86_64 1.4.4-16.el6_8.2 @updates crontabs.noarch 1.10-33.el6 @base cups-libs.x86_64 1:1.4.2-78.el6_9 @updates curl.x86_64 7.19.7-53.el6_9 @updates cvs.x86_64 1.11.23-16.el6 @base cyrus-sasl.x86_64 2.1.23-15.el6_6.2 @updates cyrus-sasl-devel.x86_64 2.1.23-15.el6_6.2 @base cyrus-sasl-lib.x86_64 2.1.23-15.el6_6.2 @updates dash.x86_64 0.5.5.1-4.el6 @base db4.x86_64 4.7.25-22.el6 @base db4-utils.x86_64 4.7.25-22.el6
Using yum command yum provides you repository information of installed packages. if you want to get a list of RPM packages installed from a specific repository only, you can filter the output with grep. Run the below command to list of installed packages from EPEL repository.
# yum list installed | grep @epel GeoIP.x86_64 1.6.5-1.el6 @epel GeoIP-GeoLite-data.noarch 2017.07-1.el6 @epel GeoIP-GeoLite-data-extra.noarch 2017.07-1.el6 @epel freetds.x86_64 0.91-2.el6 @epel geoipupdate.x86_64 2.2.1-2.el6 @epel gperftools-libs.x86_64 2.0-11.el6.3 @epel lcms2.x86_64 2.8-2.el6 @epel libmcrypt.x86_64 2.5.8-9.el6 @epel libmcrypt-devel.x86_64 2.5.8-9.el6 @epel libunwind.x86_64 1.1-3.el6 @epel libwebp.x86_64 0.4.3-3.el6 @epel mcrypt.x86_64 2.6.8-10.el6 @epel mhash.x86_64 0.9.9.9-3.el6 @epel mod_fcgid.x86_64 2.3.9-1.el6 @epel munin-common.noarch 2.0.33-1.el6 @epel munin-node.noarch 2.0.33-1.el6 @epel nginx.x86_64 1.10.2-1.el6 @epel nginx-all-modules.noarch 1.10.2-1.el6 @epel nginx-filesystem.noarch 1.10.2-1.el6 @epel nginx-mod-http-geoip.x86_64 1.10.2-1.el6 @epel nginx-mod-http-image-filter.x86_64 1.10.2-1.el6 @epel nginx-mod-http-perl.x86_64 1.10.2-1.el6 @epel nginx-mod-http-xslt-filter.x86_64 1.10.2-1.el6 @epel nginx-mod-mail.x86_64 1.10.2-1.el6 @epel nginx-mod-stream.x86_64 1.10.2-1.el6 @epel openjpeg2.x86_64 2.1.0-7.el6 @epel perl-Crypt-DES.x86_64 2.05-9.el6 @epel perl-IO-Multiplex.noarch 1.13-1.el6 @epel perl-Net-CIDR.noarch 0.18-1.el6 @epel perl-Net-SNMP.noarch 5.2.0-4.el6 @epel perl-Net-Server.noarch 2.007-2.el6 @epel python-pip.noarch 7.1.0-1.el6 @epel sqlite2.x86_64 2.8.17-10.el6 @epel v8.x86_64 1:3.14.5.10-25.el6 @epel
Method Three
repoquery is the another tools for querying information about RPM packages and yum repository. This tool is useful to check package dependencies, search files inside a package, as well as packages from different repositories. You can fully customize and format its output, so it can be fed to other tools easily.
Before using repoquery you need to install yum-utils package because it is part of yum-utils.
# yum install yum-utils
To list all installed packages:
# repoquery -a --installed ConsoleKit-0:0.4.1-6.el6.x86_64 ConsoleKit-libs-0:0.4.1-6.el6.x86_64 GConf2-0:2.28.0-7.el6.x86_64 GeoIP-0:1.6.5-1.el6.x86_64 GeoIP-GeoLite-data-0:2017.07-1.el6.noarch GeoIP-GeoLite-data-extra-0:2017.07-1.el6.noarch ImageMagick-0:6.7.2.7-6.el6.x86_64 ImageMagick-devel-0:6.7.2.7-6.el6.x86_64 ImageMagick6-libs-0:6.9.9.20-1.el6.remi.x86_64 MAKEDEV-0:3.24-6.el6.x86_64 MariaDB-client-0:10.0.32-1.el6.x86_64 MariaDB-common-0:10.0.32-1.el6.x86_64 MariaDB-compat-0:10.0.32-1.el6.x86_64 MariaDB-shared-0:10.0.32-1.el6.x86_64 MySQL-python-0:1.2.3-0.3.c1.1.el6.x86_64 ORBit2-0:2.14.17-6.el6_8.x86_64 OpenEXR-libs-0:1.6.1-8.1.el6.x86_64 apr-0:1.3.9-5.el6_2.x86_64 apr-util-0:1.3.9-3.el6_0.1.x86_64 apr-util-ldap-0:1.3.9-3.el6_0.1.x86_64 aspell-12:0.60.6-12.el6.x86_64 atk-0:1.30.0-1.el6.x86_64 audit-libs-0:2.4.5-6.el6.x86_64 audit-libs-python-0:2.4.5-6.el6.x86_64 ...... ....
To list all installed packages from EPEL repository:
# repoquery -a --installed --qf "%{name} %{ui_from_repo}" | grep @epel GeoIP @epel GeoIP-GeoLite-data @epel GeoIP-GeoLite-data-extra @epel freetds @epel geoipupdate @epel gperftools-libs @epel lcms2 @epel libmcrypt @epel libmcrypt-devel @epel libunwind @epel libwebp @epel mcrypt @epel mhash @epel mod_fcgid @epel munin-common @epel munin-node @epel nginx @epel nginx-all-modules @epel nginx-filesystem @epel nginx-mod-http-geoip @epel nginx-mod-http-image-filter @epel nginx-mod-http-perl @epel nginx-mod-http-xslt-filter @epel nginx-mod-mail @epel nginx-mod-stream @epel openjpeg2 @epel perl-Crypt-DES @epel perl-IO-Multiplex @epel perl-Net-CIDR @epel perl-Net-SNMP @epel perl-Net-Server @epel python-pip @epel sqlite2 @epel v8 @epel
Method Four
yumdb command is another useful tool If you are interested in a specific repository only. This utility queries the local yum database to find information about installed packages. The yum database is a flat file key-value store generated by the yum command to store any package-specific information.
List all installed packages from EPEL repository.
# yumdb search from_repo epel Plugin "replace" can't be imported Loaded plugins: fastestmirror GeoIP-1.6.5-1.el6.x86_64 from_repo = epel GeoIP-GeoLite-data-2017.07-1.el6.noarch from_repo = epel GeoIP-GeoLite-data-extra-2017.07-1.el6.noarch from_repo = epel freetds-0.91-2.el6.x86_64 from_repo = epel geoipupdate-2.2.1-2.el6.x86_64 from_repo = epel gperftools-libs-2.0-11.el6.3.x86_64 from_repo = epel lcms2-2.8-2.el6.x86_64 from_repo = epel libmcrypt-2.5.8-9.el6.x86_64 from_repo = epel libmcrypt-devel-2.5.8-9.el6.x86_64 from_repo = epel libunwind-1.1-3.el6.x86_64 from_repo = epel libwebp-0.4.3-3.el6.x86_64 from_repo = epel mcrypt-2.6.8-10.el6.x86_64 from_repo = epel mhash-0.9.9.9-3.el6.x86_64 from_repo = epel mod_fcgid-2.3.9-1.el6.x86_64 from_repo = epel munin-common-2.0.33-1.el6.noarch from_repo = epel munin-node-2.0.33-1.el6.noarch from_repo = epel nginx-1.10.2-1.el6.x86_64 from_repo = epel
If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.
Leave a Comment