How to List Installed Packages in CentOS with YUM and RPM

Try this guide with our instant dedicated server for as low as 40 Euros

yum list installed packages

Managing a CentOS system means knowing what software packages are installed on the system. 

This helps sysadmins, DevOps engineers, and even users to efficiently update software, fix the system, or set up a similar system configuration on another computer.

In this comprehensive tutorial, we will show you how to find out what software is installed on your CentOS system. The good part is that you can apply these methods to other Red Hat Enterprise Linux-based distros to ensure consistent system setups across machines.

Let’s start with a quick look at the prerequisites to the process.

Table Of Contents

  1. The Prerequisites
  2. How to Identify Installed Packages in CentOS
    1. Yellowdog Updater, Modified (YUM)
    2. RPM
  3. Managing Installed Packages with yum-utils
  4. Conclusion
  5. FAQs

The Prerequisites

Before diving in, ensure you have the following:

  • A system running a stable CentOS version
  • A user account with sudo or root privileges

How to Identify Installed Packages in CentOS

We will now discuss two options for listing installed packages in CentOS.

Yellowdog Updater, Modified (YUM)

YUM is a comprehensive tool for managing software packages in CentOS and other Red Hat-based Linux distributions. It simplifies various package management tasks such as installing, removing, updating, and searching software packages on your system.

Let’s see how to use YUM for package management tasks.

List All Installed Packages

Run the following command to get a complete list of the packages installed on your system:

# sudo yum list installed

This prompts YUM to display all the installed packages on your system, providing a clear overview of the system software.

Check For a Specific Package

If you need to check whether a specific package (for instance, utils) is installed on your system, we recommend refining the search with the grep utility. 

More specifically, you need to pipe the output of yum list installed into grep to filter the results and show only packages containing the search term (utils, in this case).

# sudo yum list installed | grep utils

sudo yum list installed grep utils

Get Detailed Information About a Package

You can obtain detailed information about a specific package, such as httpd, using the following YUM command:

# yum info httpd

yum info httpd

Save the List of Installed Packages to a File

You can save the list of installed packages to a file by running the following YUM command:

# sudo yum list installed > listed_packages.txt

This command saves the list of installed packages to the listed_packages.txt file. You can also use this file to replicate the current installation on another system.

Replicate the Installation on Another System

You can easily replicate the software package index of your system to another system by following these steps. 

Start by moving the file containing the package list to the new system, Run the following command and remember to replace listed_packages.txt with your filename:

# sudo yum -y install $(cat listed_packages.txt)

Here, the -y option automatically says yes for all prompts during the installation process. The cat command feeds the list of packages from listed_packages.txt into the yum install command. 

To learn more about YUM‘s capabilities, run, yum –help in the terminal.

RPM

RedHat Package Manager or RPM, is a standard feature in Red-Hat-based Linux distributions like CentOS and Fedora. 

Let’s see how you can use the capabilities of this utility.

List All Installed Packages

We recommend the following command to display all the installed packages on the system:

# sudo rpm -qa

Here, -q means query, and -a stands for all, indicating to list all installed packages.

List Packages by Installation Date

You can organize the out of the previous command by the installation date with the following slight modification:

# sudo rpm -qa --last

This sorts the package list with the most recently installed packages appearing at the beginning.

Find a Specific Package

You can find a specific package, such as the Apache server httpd, by running the following command:

# sudo rpm -qa | grep -i httpd

Similar to YUM, the following command pipes the output of rpm -qa to grep for filtering package names:

Save the List of Installed Packages to a File

To save the list of installed packages to a file, execute the following RPM command:

# sudo rpm -qa > listed_packages.txt

This command saves the package list by redirecting the output to listed_packages.txt file in the current directory.

Get Detailed Information About a Package

The following command prints detailed information about a specific package:

# rpm -qi httpd

Here, -qi combines query and info, providing detailed information about the httpd package.

Count the Total Number of Installed Packages

You can print a tally of the total number of installed packages on the system with the following command:

# sudo rpm -qa | wc -l

Here, wc counts words, and the -l option specifies the number of lines, giving the total number of installed packages. 

sudo rpm -qa

For additional options, use the rpm –help command or refer to RPM documentation.

Managing Installed Packages with yum-utils

yum-utils is a software package that enhances the capabilities of the standard YUM package management tool

Before you can use it, you should first add it to your system. For this, run the following command:

# sudo yum -y install yum-utils

Once installed, you can use the repoquery command to list all installed packages:

# sudo repoquery -a --installed

Unlike YUM or RPM, repoquery utilizes YUM repositories to gather data about packages, providing a more comprehensive view of your installed software.

Conclusion

Understanding how to list installed packages on CentOS using YUMand RPM is a fundamental skill for system administrators. This knowledge aids in managing system software and ensures smooth operations. You can join the online community for developers to share insights and tips on managing CentOS packages using YUM and RPM tools effectively.

For those managing dedicated servers or requiring high-performance hosting solutions, considering a reliable service provider like RedSwitches Bare Metal Hosting is beneficial. 

At RedSwitches, we’re dedicated to helping you discover the perfect server solutions to drive your business to new heights. So, if you’re looking for a robust server, we offer the best-dedicated server pricing and deliver instant dedicated servers, usually on the same day the order gets approved. Whether you need a dedicated server, a traffic-friendly 10Gbps dedicated server, or a powerful bare metal server, we are your trusted hosting partner.

 FAQs

Q. How do I list all installed packages on CentOS using YUM?

To list all installed packages on CentOS using YUM, use the command: yum list installed. This command displays a comprehensive list of all packages installed on your system.

Q. How can I list installed packages on CentOS with RPM?

You can list installed packages on CentOS with RPM using the command: rpm -qa. This command outputs a list of all installed packages managed by RPM on your system.

Q. What is the difference between YUM and RPM?

YUM is a high-level package manager that can automatically resolve dependencies and install all necessary packages. RPM, on the other hand, is a lower-level tool that manages individual package files but does not automatically handle dependencies.

Q. How can I ensure my CentOS system is up to date?

To update all packages to their latest versions, use sudo yum update in the terminal. This command uses YUM to update all installed packages and their dependencies to the latest versions available.

Q. What is DNF?

DNF (Dandified YUM) is the next-generation version of YUM, a package manager for RPM-based Linux distributions. It became the default package manager starting from CentOS 8, replacing YUM, and is known for its improved performance and better dependency resolution algorithm.

Q. How do I list installed packages using DNF?

To list installed packages with DNF, run:

# dnf list installed

Try this guide with our instant dedicated server for as low as 40 Euros