Friday 17 May 2013

How to enable/perform a rollback of Yum updates on RHEL/CentOS

How to enable/perform a rollback of Yum updates on RHEL/CentOS



The ability to rollback updates is not enabled by default. To enable the rollback feature follow these steps:

Use a text editor (vi for example) to open /etc/yum.conf

Add the line

tsflags=repackage

Save and exit the file

Add the following to /etc/rpm/macros (if the file doesn't exist, create it)

%_repackage_all_erasures 1


You can now rollback to previous packages by using the following commands to go back to a specified time

rpm -Uvh -rollback '6 hours ago'
rpm -Uvh -rollback 'january 1'
rpm -Uvh -rollback 'yesterday'
rpm -Uvh -rollback '18:00'


Be aware that the repackaged software will be stored in /var/spool/repackage so make sure you have free disk space on this partition!