How to downgrade package using yum

Downgrade package using yum.

Display current version of installed package.

$ yum list newrelic-infra
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.psw.services
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: miroir.univ-paris13.fr
 * updates: mirrors.nav.ro
Installed Packages
newrelic-infra.x86_64                                                                                    1.5.51-1                                                                                     @newrelic-infra

Display available versions of specific package.

$ yum --showduplicates list newrelic-infra | less
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.psw.services
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: miroir.univ-paris13.fr
 * updates: mirrors.nav.ro
Installed Packages
newrelic-infra.x86_64                 1.5.51-1                   @newrelic-infra
Available Packages
newrelic-infra.x86_64                 1.0.301-1                  newrelic-infra 
newrelic-infra.x86_64                 1.0.308-1                  newrelic-infra 
newrelic-infra.x86_64                 1.0.316-1                  newrelic-infra 
newrelic-infra.x86_64                 1.0.323-1                  newrelic-infra 
[...]
newrelic-infra.x86_64                 1.1.4-1                    newrelic-infra
newrelic-infra.x86_64                 1.1.7-1                    newrelic-infra
newrelic-infra.x86_64                 1.1.9-1                    newrelic-infra
newrelic-infra.x86_64                 1.1.14-1                   newrelic-infra
newrelic-infra.x86_64                 1.1.19-1                   newrelic-infra
[...]
newrelic-infra.x86_64                 1.5.40-1                   newrelic-infra
newrelic-infra.x86_64                 1.5.42-1                   newrelic-infra
newrelic-infra.x86_64                 1.5.45-1                   newrelic-infra
newrelic-infra.x86_64                 1.5.51-1                   newrelic-infra

Downgrade specific package.

$ sudo yum downgrade newrelic-infra-1.5.45-1
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.psw.services
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: miroir.univ-paris13.fr
 * updates: mirrors.nav.ro
Resolving Dependencies
--> Running transaction check
---> Package newrelic-infra.x86_64 0:1.5.45-1 will be a downgrade
---> Package newrelic-infra.x86_64 0:1.5.51-1 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================
 Package                                  Arch                              Version                             Repository                                Size
===============================================================================================================================================================
Downgrading:
 newrelic-infra                           x86_64                            1.5.45-1                            newrelic-infra                           7.0 M

Transaction Summary
===============================================================================================================================================================
Downgrade  1 Package

Total download size: 7.0 M
Is this ok [y/d/N]: y
Downloading packages:
newrelic-infra-1.5.45-1.x86_64.rpm                                                                                                           | 7.0 MB  00:00:01 
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : newrelic-infra-1.5.45-1.x86_64                                                                                                               1/2 
Removed symlink /etc/systemd/system/multi-user.target.wants/newrelic-infra.service.
   Active: active (running) since Thu 2019-10-17 07:37:31 UTC; 51min ago
  Cleanup    : newrelic-infra-1.5.51-1.x86_64                                                                                                               2/2 
Created symlink from /etc/systemd/system/multi-user.target.wants/newrelic-infra.service to /etc/systemd/system/newrelic-infra.service.
  Verifying  : newrelic-infra-1.5.45-1.x86_64                                                                                                               1/2 
  Verifying  : newrelic-infra-1.5.51-1.x86_64                                                                                                               2/2 

Removed:
  newrelic-infra.x86_64 0:1.5.51-1

Installed:
  newrelic-infra.x86_64 0:1.5.45-1

Complete!

Display current version of installed package.

$ yum list newrelic-infra
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.psw.services
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: miroir.univ-paris13.fr
 * updates: mirrors.nav.ro
Installed Packages
newrelic-infra.x86_64                 1.5.45-1                   @newrelic-infra
Available Packages
newrelic-infra.x86_64