In this howto I will describe how to Downgrade a RPM Package Using YUM. Yum came with a plugin named yum-allowdowngrade which allow you to downgrade any existing install RPM to older version. This requirement came from one of my client server that it requires to downgrade PHP version from 5.3.8 to 5.2.17.
1) Check Already Installed RPM and Required RPM
Following command will check which rpm version is installed.
rpm -qa | grep php
The next command will show you all available version using yum. Be noted I am using atomic repository for my PHP upgrade and downgrade. But you can do this with any rpm hence yum provide you with lower version of rpm package. How to add atomic repository kindly see my following post
https://www.sohailriaz.com/how-to-update-php-on-servers-centosfedorarhel/
yum list | grep php | grep atomic
2) Install YUM Plugin
Issue following command to install yum-allowdowngrade plugin
yum -y install yum-allowdowngrade
3) Downgrade RPM Install
First you should be sure what rpm’s you are going to downgrade. For my list I will using already install PHP rpm package name with downgrade argument, which let yum to automatically use the lower version to install and remove the current version of PHP.
yum downgrade php-dba php-soap php-ldap php-mysql php-mcrypt php-common php-cli php-gd php-odbc php-xmlrpc php-snmp php-bcmath php-imap- php-devel php-pdo php php-pgsql php-pgsql php-mbstring php-xml
The above command detect the lower version 5.2.17 at itself and give me option to downgrade the php version to 5.2.17. By giving y to start the installation, it removes the current php version, save the configuration files and install the older version of php 5.2.17. Which was than verified using following commands
rpm -qa | grep php
shows install php rpm with version, additionally you can use php command with version option
php –version
If you have any question please comment.