Question: How to downgrade an rpm package in CentOS/RHEL 6 system to a lower version using the “rpm” command?
Its not really recommended to use rpm command instead of yum to downgrade an rpm package. But in case if you don’t have a choice use the below procedure.
Pre-requisites
Make sure you have downloaded all the packages and its dependencies for the lower version.
Downgrading rpm version
For the purpose of this post we are downgrading the systemd packages from systemd-219-67.0.1.el7_7.2 to systemd-219-62.0.4.el7_6.9.
1. Download the lower version of a package and its dependency. In our case, we have downlaowded all the required dependent packages as shown below.
[root@geeklab /]# ls libgudev1-219-62.0.4.el7_6.9.x86_64.rpm systemd-python-219-62.0.4.el7_6.9.x86_64.rpm systemd-219-62.0.4.el7_6.9.x86_64.rpm systemd-sysv-219-62.0.4.el7_6.9.x86_64.rpm systemd-libs-219-62.0.4.el7_6.9.x86_64.rpm
They are all depended lower version of systemd packages.
2. To downgarde the rpm package, use the below commadn syntax.
# rpm -Uvh --oldpackage [downloaded_lower_version_package]
For example:
[root@geeklab /]# rpm -Uvh --oldpackage *.rpm Preparing... ################################# [100%] Updating / installing... 1:systemd-libs-219-62.0.4.el7_6.9 ################################# [ 10%] 2:systemd-219-62.0.4.el7_6.9 ################################# [ 20%] 3:systemd-python-219-62.0.4.el7_6.9################################# [ 30%] 4:systemd-sysv-219-62.0.4.el7_6.9 ################################# [ 40%] 5:libgudev1-219-62.0.4.el7_6.9 ################################# [ 50%] Cleaning up / removing... 6:systemd-python-219-67.0.1.el7_7.2################################# [ 60%] 7:systemd-sysv-219-67.0.1.el7_7.2 ################################# [ 70%] 8:systemd-219-67.0.1.el7_7.2 ################################# [ 80%] 9:libgudev1-219-67.0.1.el7_7.2 ################################# [ 90%] 10:systemd-libs-219-67.0.1.el7_7.2 ################################# [100%]
We have successfully downgraded the systemd packages from version systemd-219-67.0.1.el7_7.2 to systemd-219-62.0.4.el7_6.9.