During this article, we are going to cover how to downgrade an already installed package or an application on CentOS. Previously we have shown you how to downgrade a program on Ubuntu click here to check the tutorial.
Downgrading applications and packages on CentOS
There are three methods which will help you in downgrading a package on CentOS:
- Downgrade using rpm command.
- Downgrade using yum command.
- Downgrade using yum history command.
For this tutorial, we will be using the firefox package to perform the downgrade process. It’s highly recommended to be careful while using the below commands.
First Method: Downgrade Using rpm Command
Step 1. Check the currently installed Firefox version.
firefox --version
Also, you can use the next command to get the firefox version.
rpm -qa | grep firefox
Step 2. Next, you can download the firefox rpm package from your browser, but be careful not to download from untrusted sources.
Step 3. After downloading the rpm package, use the next command to downgrade Firefox.
rpm -Uvh --oldpackage Downloads/firefox-60.5.0-2.el7.centos.x86_64.rpm
Step 4. Check the current Firefox version after downgrading.
rpm -qa | grep firefox
Second Method: Downgrade Using yum Command
Step 1. List all the current firefox packages from the yum cache.
yum --showduplicates list firefox
Step 2. Downgrade firefox using yum command.
sudo yum downgrade firefox
Now the yum command will first download the old firefox package.
After downloading the package successfully, you will get an output like the below screenshot:
Step 3. Now you can check the firefox version.
rpm -qa | grep firefox
Third Method: Downgrade Using yum history Command
This method depends on listing the yum command history, which means containing all the yum commands that are used. Then rollback the changes that have been done to a specific command from the history.
So to better understand this method we will need first to update Firefox (In your case you need to downgrade so skip this step and start from step 3).
Step 1. Update the firefox package using the next command.
sudo yum update firefox
After the firefox updates successfully the output will look like the below screenshot:
Step 2. Check the firefox version after updating.
rpm -qa | grep firefox
Step 3. List all the yum command history alongside with their ID.
sudo yum history
As you can see from the previous screenshot that there is an Update action with ID 5, next, we will use the ID of this transaction to get more information about it.
Step 4. Get more information for a specific yum transaction.
sudo yum history info 5
Step 5. Now in case you need to rollback to ID number 5, then use the following command.
sudo yum history undo 5
Step 6. Finally, you can check the current firefox package version.
rpm -qa | grep firefox
Congratulations, you just have learned how to downgrade an already installed centos package in many ways, you can choose the best method which suits you well.