Rollback an update on RHEL/CentOS – A simple guide
Yum is default package manager for RPM based Linux distributions like RHEL, CentOS & is used to managing packages for the system. We can install, remove or update packages using the yum command. But can we rollback an update that has been installed on the system ?
Yes, we can easily rollback an installed updated using the yum with yum history command. We can easily rollback a small update for an installed service but downgrading a system to minor version is not recommended as it can lead to system instability. So in short we can rollover an update for small service like for httpd but rollback from RHEL 6.9 to 6.8 is not recommended.
Important Note:- Rollback of Selinux, selinux-policy-*, kernel, glibc (dependencies of glibc such as gcc) packages to older version is not supported.
We will now discuss how we can rollback an update using yum history command on RHEL/CentOS.
(Recommended Read: Some pretty useful YUM tips & tricks)
Rollback an update
Let’s install a package to take as an example. We will install httpd i.e. apache web server on the system with the following command,
# yum install httpd
You can check if the package has been installed by running the following command,
# httpd -version
Now that we have a package installed, we will need transaction ID for this transaction to undo. We can get the transaction ID by executing the following command from terminal,
$ yum history
This will produce the list of transactions that happened on the system along with their transaction ID,
Now all we have to do is to run the command ‘yum history undo’ followed by the transaction id that we want to rollback,
# yum history undo 7
This will remove the package from the system. You can than go ahead check again if the package is there or not.