How to roll back/revert installed package and update in Rhel/Centos 7
Hi Friends, in this article, we will learn how to roll back the installed package in RHEL/Centos 7. it’s very important to patch your server time to time because patching a server will help you to make more secure, increase the proficiency of the server.
But sometimes patches put you in a difficult situation like suppose you have an application that supports a specific version of the software but due to a patch you have upgraded the package. now your application stopped to work.
In this situation you need to roll back your patch or installed software in machine.
Even some time patching the server upgrade the OS version also on Azure Cloud. Like you created a RedHat/Centos server with version 7.5 but after patching this server it will upgrade to 7.X.
So, let us see how we can manage it.
Here, I’m going to installing xrdp and nginx package for example.
[root@linuxfork ~]# yum install xrdp
Check the Last Transaction
we will use the below command to check the latest transaction on the system. Here transaction is nothing it’s an operation.
[root@linuxfork ~]# yum history info Loaded plugins: fastestmirror, langpacks Transaction ID : 9 Begin time : Sat Nov 14 08:13:51 2020 Begin rpmdb : 523:a82a88bb16ecbfb13cff23e986017a838a5e68a6 End time : 08:14:00 2020 (9 seconds) End rpmdb : 562:3327ef9c9950d484b095ee7193c1a6bd3bf01440 User : <sysadmin> Return-Code : Success Command Line : install xrdp Transaction performed with: Installed rpm-4.11.3-43.el7.x86_64 @base Installed yum-3.4.3-167.el7.centos.noarch @base Installed yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch @updates Packages Altered: Dep-Install fuse-libs-2.9.2-11.el7.x86_64 @base Dep-Install gnutls-3.3.29-9.el7_6.x86_64 @base Dep-Install libICE-1.0.9-9.el7.x86_64 @base Dep-Install libSM-1.2.2-2.el7.x86_64 @base Dep-Install libXcursor-1.1.15-1.el7.x86_64 @base Dep-Install libXdamage-1.1.4-4.1.el7.x86_64 @base Dep-Install libXdmcp-1.1.2-6.el7.x86_64 @base
Here, we can see last transaction ID is “9”
List All Transaction
[root@linuxfork ~]# yum history Loaded plugins: fastestmirror, langpacks ID | Login user | Date and time | Action(s) | Altered ------------------------------------------------------------------------------- 9 | <sysadmin> | 2020-11-14 08:13 | Install | 39 8 | <sysadmin> | 2020-11-14 08:12 | Erase | 47 7 | <sysadmin> | 2020-11-14 07:52 | I, O, U | 329 EE 6 | <sysadmin> | 2020-11-14 05:23 | I, U | 17 5 | <sysadmin> | 2020-11-14 05:20 | Install | 39 4 | <sysadmin> | 2020-11-14 05:19 | Erase | 39 3 | <sysadmin> | 2020-11-14 05:00 | Install | 39 2 | <sysadmin> | 2020-11-14 04:55 | Install | 1 1 | System <unset> | 2018-08-15 19:31 | Install | 506 history list [root@linuxfork ~]#
Below command also gives same output as above.
[root@linuxfork ~]# yum history list [root@linuxfork ~]# yum history list all
Roll Back/Revert back Installation
Now, let’s we need to revert back/rollback the last installation on the server. so, we have seen our last transaction ID is “9”.
[root@linuxfork ~]# yum history undo [Transaction ID]
[root@linuxfork ~]# yum history undo 9
Above command will remove xrdp package as well as installed dependency.
I am a professional Cloud Engineer and founder of LinuxFork. I am working on Infrastructure Deployment and focusing on the integration of open source technologies with the Cloud. I am an avid Linux lover and open source enthusiast. mostly, I am working with Redhat and Ubuntu Linux in the production environment. apart from this I always believe in knowledge sharing.