The Yum package manager includes a little known rollback & repackage function that allows you to rollback updates. Repackaging can take a lot of space, so it’s disabled by default!
The rollback mechanism can undo package installations by uninstalling the newly-installed packages, and since a software update is a performed by installing a new package version and then removing the old one, the rollback mechanism can also undo package updates.
To enable rollback:
echo ‘tsflags=repackage’ >> /etc/yum.conf
echo ‘%_repackage_all_erasures 1′ >> /etc/rpm/macros
Repackaged files are stored in /var/spool/repackage. Once you’ve run an update, check this directory and you will see the previous packages listed there.
ls -lha /var/spool/repackage
You can then use the rpm command to execute rollbacks to a previous state by time or date, e.g.
rpm -Uhv –rollback ’9:00 am’
rpm -Uhv –rollback ’4 hours ago’
rpm -Uhv –rollback ‘december 25′
Note: As of yum version 3.2.25 you should use the Yum history command instead. A simple restore using this command would involve running:
yum history
This will list all Yum updates, with a transaction ID number next to them. To query the update, use this transaction ID number (let’s say 27 for this example) and the info option:
yum history info 27
This will display detailed information about the update. If you then decide you want to roll-back this update, run history command with the undo option:
yum history undo 27
Yum history supports the following options – ‘info|list|summary|redo|undo|new’. Check the Yum man page for details of the options, and more suggestions on using history.