List Installed Packages With yum

list installed packages with yum

In this short tutorial, we’ll show you, how to list installed packages with yum. This includes using the yum caching feature to speed up our searches, list available packages and list installed packages, query package repositories and get information about the packages.

This tutorial applies to Linux distributions that make use of the Yum package manager, that includes CentOS and RedHat, but also older Fedora distributions.

Prerequisites:

1. Updating the cache

Before we begin it is useful to update our Yum cache database with the latest package information. This command will update the cache database from the currently enabled yum repositories on our system and it is particularly useful so that yum does not update its information every time we want to install something or query a package for information.

# yum makecache

base | 3.6 kB 00:00:00
epel/x86_64/metalink | 14 kB 00:00:00
epel | 4.3 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
webtatic | 3.6 kB 00:00:00
(1/14): base/7/x86_64/other_db | 2.4 MB 00:00:00
(2/14): epel/x86_64/filelists_db | 7.5 MB 00:00:00
(3/14): epel/x86_64/updateinfo | 728 kB 00:00:00
(4/14): epel/x86_64/primary_db | 4.5 MB 00:00:00
(5/14): updates/7/x86_64/filelists_db | 1.5 MB 00:00:00
(6/14): updates/7/x86_64/prestodelta | 285 kB 00:00:00
(7/14): updates/7/x86_64/primary_db | 2.2 MB 00:00:00
(8/14): epel/x86_64/other_db | 2.0 MB 00:00:00
(9/14): extras/7/x86_64/prestodelta | 101 kB 00:00:00
(10/14): extras/7/x86_64/filelists_db | 423 kB 00:00:00
(11/14): updates/7/x86_64/other_db | 24 MB 00:00:00
(12/14): extras/7/x86_64/other_db | 423 kB 00:00:00
(13/14): webtatic/x86_64/filelists_db | 89 kB 00:00:00
(14/14): webtatic/x86_64/other_db | 65 kB 00:00:00
Metadata Cache Created

From the output, we can see that the enabled repositories on our system are the base, epel, extras, updates and the webtatic repositories.

2. Query installed packages

Imagine that you are connected to someone’s server and you need to figure out what is already installed. You can list all installed packages with yum using:

# yum list installed

The output should be a long list of packages. This isn’t very usefully to us, unless we are preparing an internal documentation for reference purposes. So let’s go further and filter out the results a bit. We wish to find out all of the PHP-related packages.

# yum list installed | grep php

php71w-cli.x86_64 7.1.0-1.w7 @webtatic
php71w-common.x86_64 7.1.0-1.w7 @webtatic
php71w-devel.x86_64 7.1.0-1.w7 @webtatic
php71w-fpm.x86_64 7.1.0-1.w7 @webtatic
php71w-gd.x86_64 7.1.0-1.w7 @webtatic
php71w-imap.x86_64 7.1.0-1.w7 @webtatic
php71w-mbstring.x86_64 7.1.0-1.w7 @webtatic
php71w-mcrypt.x86_64 7.1.0-1.w7 @webtatic
php71w-mysql.x86_64 7.1.0-1.w7 @webtatic
php71w-pdo.x86_64 7.1.0-1.w7 @webtatic
php71w-pear.noarch 1:1.10.1-1.w7 @webtatic
php71w-pecl-apcu.x86_64 5.1.7-1.w7 @webtatic
php71w-pecl-apcu-devel.x86_64 5.1.7-1.w7 @webtatic
php71w-pecl-mongodb.x86_64 1.2.1-1.w7 @webtatic
php71w-process.x86_64 7.1.0-1.w7 @webtatic
php71w-snmp.x86_64 7.1.0-1.w7 @webtatic
php71w-xml.x86_64 7.1.0-1.w7 @webtatic

This is much better, and it will allow us to see all of the php* packages on our system. The output above is as follows. The first column is the package name. The second column is the package version and the third column is the repository from where the package has been installed.

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS

3. Install additional PHP modules

Now let’s install some additional PHP modules. We already know that our system uses php71, so we will need to look for php71* available modules.

# yum search php71

mod_php71w.x86_64 : PHP module for the Apache HTTP Server
php71w-bcmath.x86_64 : A module for PHP applications for using the bcmath library
php71w-cli.x86_64 : Command-line interface for PHP
php71w-common.x86_64 : Common files for PHP
php71w-dba.x86_64 : A database abstraction layer module for PHP applications
php71w-devel.x86_64 : Files needed for building PHP extensions
php71w-embedded.x86_64 : PHP library for embedding in applications
php71w-enchant.x86_64 : Enchant spelling extension for PHP applications
php71w-fpm.x86_64 : PHP FastCGI Process Manager
php71w-gd.x86_64 : A module for PHP applications for using the gd graphics library
php71w-imap.x86_64 : A module for PHP applications that use IMAP
php71w-interbase.x86_64 : A module for PHP applications that use Interbase/Firebird databases
php71w-intl.x86_64 : Internationalization extension for PHP applications
php71w-ldap.x86_64 : A module for PHP applications that use LDAP
php71w-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
php71w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php71w-mysql.x86_64 : A module for PHP applications that use MySQL databases
php71w-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php71w-odbc.x86_64 : A module for PHP applications that use ODBC databases
php71w-opcache.x86_64 : An opcode cache Zend extension
php71w-pdo.x86_64 : A database access abstraction module for PHP applications
php71w-pdo_dblib.x86_64 : MSSQL database module for PHP
php71w-pear.noarch : PHP Extension and Application Repository framework
php71w-pecl-apcu.x86_64 : APCu - APC User Cache
php71w-pecl-apcu-devel.x86_64 : APCu developer files (header)
php71w-pecl-igbinary.x86_64 : Replacement for the standard PHP serializer
php71w-pecl-igbinary-devel.x86_64 : Igbinary developer files (header)
php71w-pecl-mongodb.x86_64 : PECL package MongoDB driver
php71w-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php71w-pecl-xdebug.x86_64 : PECL package for debugging PHP scripts
php71w-pgsql.x86_64 : A PostgreSQL database module for PHP
php71w-phpdbg.x86_64 : Interactive PHP debugger
php71w-process.x86_64 : Modules for PHP script using system process interfaces
php71w-pspell.x86_64 : A module for PHP applications for using pspell interfaces
php71w-recode.x86_64 : A module for PHP applications for using the recode library
php71w-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices
php71w-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php71w-tidy.x86_64 : Standard PHP module provides tidy library support
php71w-xml.x86_64 : A module for PHP applications which use XML
php71w-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol

Now let’s find out how can we retrieve some package information. This implies to both installed and not yet installed packages.

4. Getting package information – the lazy way

Let’s imagine that one of your colleagues (without administrative privileges) asked you to install Lynx and MC for him. Now you are probably asking what those packages are and you are too lazy to look that up on a browser.

# yum info lynx
Installed Packages
Name        : lynx
Arch        : x86_64
Version     : 2.8.8
Release     : 0.3.dev15.el7
Size        : 5.4 M
Repo        : installed
From repo   : base
Summary     : A text-based Web browser
URL         : http://lynx.isc.org/
Licence     : GPLv2
Description : Lynx is a text-based Web browser. Lynx does not display any images,
            : but it does support frames, tables, and most other HTML tags. One
            : advantage Lynx has over graphical browsers is speed; Lynx starts and
            : exits quickly and swiftly displays web pages.

# yum info mc
Installed Packages
Name : mc
Arch : x86_64
Epoch : 1
Version : 4.8.7
Release : 11.el7
Size : 5.6 M
Repo : installed
From repo : base
Summary : User-friendly text console file manager and visual shell
URL : http://www.midnight-commander.org/
Licence : GPLv3+
Description : Midnight Commander is a visual shell much like a file manager, only
: with many more features. It is a text mode application, but it also
: includes mouse support. Midnight Commander's best features are its
: ability to FTP, view tar and zip files, and to poke into RPMs for
: specific files.

From the output, we can tell that lynx is a terminal based web browser, and mc is a terminal based, user-friendly file manager.

5. Cleaning up

Once we have finished working, it is useful to clean up any unwanted cache files. These files are stored in /var/cache/yum and are created by the yum makecache command. To clear the cache just run:

# yum clean all

Of course, you don’t have to list installed packages with yum, if you use one of our Managed VPS Hosting Services, in which case you can simply ask our expert Linux admins to list all installed packages with yum, on your server. They are available 24×7 and will take care of your request immediately. You can also consider reading our post about List All Installed Packages with yum on CentOS 7.

PS. If you liked this post on how to list installed packages with yum, please share it with your friends on the social networks using the buttons below or simply leave a reply in the comments sections. Thanks.

2 thoughts on “List Installed Packages With yum”

Leave a Comment