How to list all available versions of a package in RPM repository

Written by - 0 comments

Published on - last updated on March 5th 2024 - Listed in Linux


Sometimes you want to check if the configured RPM repositories already contain an updated version of a package - or you simply want to get a list of installable versions of a package. But how can you simply list the available versions of a package in a RPM repo?

List all available versions of a package in RPM repository

dnf search shows no version

The "obvious" command to enter is most likely dnf search - since we're searching for a specific package and its versions. But the output does not show any version at all - it only shows the package name itself:

[root@rhel9 ~]# dnf search my-fancy-package
Updating Subscription Management repositories.
Last metadata expiration check: 0:03:08 ago on Mon 04 Mar 2024 03:58:59 PM CET.
==================== Name Exactly Matched: my-fancy-package ====================
my-fancy-package.noarch : my super fancy package

dnf info shows version - but only one version

When using a DEB based Linux distribution (such as Debian or Ubuntu), the command apt-cache show <pkgname> would reveal the version(s) of the package. Maybe this also goes for RPM based Linux distributions? 

The equivalent command would be dnf info <pkgname>, so let's try this:

[root@rhel9 ~]# dnf info my-fancy-package
Updating Subscription Management repositories.
Extra Packages for Enterprise Linux 9  137 kB/s | 2.6 kB     00:00
Shared Packages for Enterprise Linux 9 139 kB/s | 2.6 kB     00:00
Installed Packages
Name         : my-fancy-package
Version      : 1.1.21
Release      : 1.el9
Architecture : noarch
Size         : 357 k
Source       : my-fancy-package-1.1.21-1.el9.src.rpm
Repository   : @System
Summary      : my super fancy package
License      : GPLv3
Description  : my super fancy package

Unfortunately only one version (1.1.21) is showing up in the output. The Repository entry mentions @System, which means this is the currently installed package. 

But what about the other available versions of this package, still sitting in the RPM repo? I want to list them!

dnf list - with additional parameter!

Similar is the output of dnf list <pkgname>; the output is - again - only showing the version of the installed package:

[root@rhel9 ~]# dnf info my-fancy-package
Updating Subscription Management repositories.
Extra Packages for Enterprise Linux 9  137 kB/s | 2.6 kB     00:00
Shared Packages for Enterprise Linux 9 139 kB/s | 2.6 kB     00:00
Installed Packages
my-fancy-package.noarch    1.1.21-1.el9      @System

However with an additional parameter --showduplicates, all the available package versions from the repository are finally showing up!

[root@rhel9 ~]# dnf list my-fancy-package --showduplicates
Updating Subscription Management repositories.
Extra Packages for Enterprise Linux 9          139 kB/s | 2.6 kB     00:00
Shared Packages for Enterprise Linux 9         145 kB/s | 2.6 kB     00:00
Installed Packages
my-fancy-package.noarch          1.1.21-1.el9  @System
Available Packages
my-fancy-package.noarch          1.1.15-1.el9  Internal_Repo_shared-9
my-fancy-package.noarch          1.1.16-1.el9  Internal_Repo_shared-9
my-fancy-package.noarch          1.1.17-1.el9  Internal_Repo_shared-9
my-fancy-package.noarch          1.1.18-1.el9  Internal_Repo_shared-9
my-fancy-package.noarch          1.1.20-1.el9  Internal_Repo_shared-9
my-fancy-package.noarch          1.1.20-2.el9  Internal_Repo_shared-9
my-fancy-package.noarch          1.1.20-3.el9  Internal_Repo_shared-9

It's really not obvious, but the dnf list <pkgname> --showduplicates command lists all the available package versions from the repository.

Updated package command cheat sheet

With this dnf command just learned, the Linux package command cheat sheet, which shows a comparison of yum, dnf, apt, zypper and rpm vs. deb commands, was updated.


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Icingaweb   Icingaweb2   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder   


Update cookies preferences