How to Check if a Package is Available In Yum

15

Yellowdog Updater Modified or Yum for short is a package management tool for RPM packages. It is popular in the REHL family of Linux distributions, including CentOS and Fedora. Thus, you can think of yum as a bootstrap for RPM package manager.

Like popular package managers, Yum works via repositories that contain collections of tools in rpm format.

For this quick one, we will discuss the basics of yum and show available packages on a system using yum as a package manager.

Yum List Available Packages

To show available packages, we can use the yum list command as shown:

This command will display the name of all the available packages, the latest version, and the repositories to which they belong

Yum Check Installed Packages

Yum is incredibly easy to use; like most package managers, it allows you to pass intuitive options. For example, to show the list of installed packages, we can use the command:

Similar to show available packages, the command above will show the name of the packages installed, the version, and the source repository of the packages

You can pass the output from the command above to tools such as grep, less, etc.

Yum Search Specific Package

An example use case of the yum list command is checking if you have a specific package installed. For example, let us see if awk is installed.

sudo yum list installed | grepawk

The above command passes the output of the yum list to grep, which then searches for the specific string, in this case, ‘awk.’ Take a look at the example output below:

As you can see, we have awk installed (as part of gawk) and the python-Hawkey package.

Show Available Packages From A Specific Repo

You can also filter for the available package in a specific repository. We can start by listing all enabled repositories with the command:

This will list all the available repositories in the system.

To search for packages available only in a specific repo. An example, in the epel repository, we use the command:

sudo yum list available | grep epel

Example output is as shown:

Conclusion

In this quick tutorial, we covered yum and showed the available and installed packages in the system.

Thanks for reading!

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More