How to roll back an update in CentOS or RedHat
This post explains how to roll back an update in CentOS using yum. Sometimes a package update may lead to unexpectable problems on your system. It is very helpful if we can revert the update in such cases. The command yum history helps to revert the latest updates. Continue reading to know how to use yum to revert an update.
If you want to print the full yum transaction history, just run the command:
yum history
Sample Output:
[root@server ~]# yum history Loaded plugins: fastestmirror ID | Login user | Date and time | Action(s) | Altered ---------------------------------------------------------------- 23 | root | 2019-04-19 03:44 | Update | 17 E< 22 | root | 2019-03-31 03:36 | Install | 1 > 21 | root | 2019-03-31 03:35 | Install | 42 20 | root | 2019-03-31 03:33 | Install | 1 19 | root | 2019-03-31 01:24 | Install | 9 18 | root | 2019-03-31 01:24 | Erase | 9 EE 17 | root | 2019-03-31 00:54 | Install | 9 16 | root | 2019-03-31 00:53 | Erase | 9 15 | root | 2019-03-31 00:39 | Install | 4 14 | root | 2019-03-31 00:09 | Install | 1 13 | root | 2019-03-31 00:09 | Install | 1 12 | root | 2019-03-31 00:09 | Install | 2 11 | root | 2019-03-31 00:07 | Install | 25 10 | root | 2019-03-31 00:06 | Install | 1 9 | root | 2019-03-31 00:06 | Install | 1 8 | root | 2019-03-31 00:03 | Install | 38 7 | root | 2019-03-31 00:02 | Install | 5 6 | System | 2019-03-30 23:59 | I, O, U | 201 EE 5 | root | 2018-01-08 06:44 | Install | 4 4 | root | 2018-01-08 06:22 | Install | 1 history list [root@server ~]#
To have information about a transaction:
yum history info <Transaction ID>
Here, I am quriying about the transaction ID 22 to provide you an example:
[root@server ~]# yum history info 22 Loaded plugins: fastestmirror Transaction ID : 22 Begin time : Sun Mar 31 03:36:31 2019 Begin rpmdb : 426:31e16c0521bbf7d8d4ac5d1aa103524e56f06b53 End time : (0 seconds) End rpmdb : 427:306e3c38d229651383d292dbd72ede56ed42118e User : root <root> Return-Code : Success Command Line : install mlocate -y Transaction performed with: Installed rpm-4.11.3-35.el7.x86_64 @base Installed yum-3.4.3-161.el7.centos.noarch @base Installed yum-plugin-fastestmirror-1.1.31-50.el7.noarch @base Packages Altered: Install mlocate-0.26-8.el7.x86_64 @base history info [root@server ~]#
To undo a transaction:
yum history undo <Transaction ID>
For example, the altered packages in transaction 22 can be reverted using the following command:
[root@server ~]# yum history undo 22 Loaded plugins: fastestmirror Undoing transaction 22, from Sun Mar 31 03:36:31 2019 Install mlocate-0.26-8.el7.x86_64 @base Resolving Dependencies --> Running transaction check ---> Package mlocate.x86_64 0:0.26-8.el7 will be erased --> Finished Dependency Resolution Dependencies Resolved ================================================================= Package Arch Version Repository Size ================================================================= Removing: mlocate x86_64 0.26-8.el7 @base 379 k Transaction Summary ================================================================= Remove 1 Package Installed size: 379 k Is this ok [y/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Erasing : mlocate-0.26-8.el7.x86_64 1/1 Verifying : mlocate-0.26-8.el7.x86_64 1/1 Removed: mlocate.x86_64 0:0.26-8.el7 Complete! [root@server ~]#
Note: Roll back of the packages selinux, selinux-policy-*, kernel, glibc to older version is not supported. Use yum history for small roll back as it is not recommended to downgrade a system to a minor version. ex: CentOS 6.10 to CentOS 6.9)
That’s it!
Also Read:
- Install iftop on CentOS or Redhat Server
- How to avoid accidental deletion of files in Linux
- Install Linux Environment Security (LES)
- Install RPMForge Repository on CentOS / RHEL
- Install MongoDB on cPanel or CentOS
- How to install FFMPEG on cPanel
- How to Install OpenVPN on CentOS and Derivatives
- How to Install Viber on Ubuntu and CentOS
- How to Install Sublime Text on Ubuntu and CentOS
- Install TNEF and libwbxml in CentOS and Ubuntu
- How to install ifconfig on CentOS 7
- Install Phusion Passenger on cPanel or CentOS

If you like the post Understanding top Command and wish to receive more articles from us, please like our FB page: GrepItOut
Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments. For more details on our services, please drop us an E-mail at info@grepitout.com
Add Comment