How to Check Package Version After Yum Search: A Practical Guide for Linux Admins


3 views

When you run yum search rabbitmq, the output shows available packages but doesn't display version information by default:

rabbitmq-server.noarch : The RabbitMQ server

This can be frustrating when you need to know the exact version before installation or troubleshooting.

The most straightforward way is to use yum info:

yum info rabbitmq-server

This will return detailed information including:

Name        : rabbitmq-server
Version     : 3.8.2
Release     : 1.el7
Architecture: noarch

To see all available versions in your repositories:

yum --showduplicates list rabbitmq-server

Sample output:

rabbitmq-server.noarch   3.8.2-1.el7    epel
rabbitmq-server.noarch   3.7.8-1.el7    epel

For more advanced queries, install and use repoquery:

yum install yum-utils
repoquery --qf "%{name}-%{version}-%{release}.%{arch}" rabbitmq-server

Here's a complete workflow for version checking:

# Search for package
yum search rabbitmq

# Get version info
yum info rabbitmq-server | grep -E "Version|Release"

# Alternative with repoquery
repoquery -i rabbitmq-server | grep -E "Version|Release"

Knowing package versions helps with:

  • Compatibility checks with other software
  • Security vulnerability assessment
  • Feature availability verification
  • Reproducible deployments

For scripting purposes, you can extract just the version:

yum info rabbitmq-server | awk '/^Version/ {print $3}'

Or combine with release:

yum info rabbitmq-server | awk '/^Version/ {v=$3} /^Release/ {r=$3} END {print v"-"r}'

When you run yum search rabbitmq or similar commands, the output typically shows package names and brief descriptions without version information. This is by design, as yum search is meant for discovering available packages rather than displaying detailed version information.

Here are several effective ways to check package versions in CentOS/RHEL systems:

1. Using yum info

The most straightforward method is to use yum info:

yum info rabbitmq-server

Sample output:

Available Packages
Name        : rabbitmq-server
Arch        : noarch
Version     : 3.8.2
Release     : 1.el7
Size        : 8.5 M
Repo        : epel
Summary     : The RabbitMQ server
URL         : https://www.rabbitmq.com/
License     : MPLv1.1
Description : RabbitMQ is an implementation of AMQP, the emerging standard for high
            : performance enterprise messaging.

2. Using yum list

For a more concise version display:

yum list rabbitmq-server

Sample output:

Available Packages
rabbitmq-server.noarch  3.8.2-1.el7  epel

3. Checking available versions

To see all available versions (including older ones in some cases):

yum --showduplicates list rabbitmq-server

For more complex scenarios:

Using repoquery

If you have yum-utils installed:

repoquery rabbitmq-server

Checking installed version

If the package is already installed:

rpm -q rabbitmq-server

Here's a bash script example to extract just the version number:

#!/bin/bash
package="rabbitmq-server"
version=$(yum info $package | grep -i "version" | head -1 | awk '{print $3}')
echo "Latest available version of $package: $version"

For parsing multiple packages:

#!/bin/bash
packages=("rabbitmq-server" "nginx" "postgresql")
for pkg in "${packages[@]}"
do
    version=$(yum info $pkg 2>/dev/null | grep -i "version" | head -1 | awk '{print $3}')
    [ -z "$version" ] && version="Not available"
    printf "%-15s %s\n" "$pkg:" "$version"
done

If you're using newer RHEL/CentOS versions with dnf:

dnf info rabbitmq-server

For Debian/Ubuntu systems (comparison):

apt-cache show rabbitmq-server | grep Version