Roll back RPM packages – CentOS/RedHat

Wouldn’t it be useful to be able to easily undo a yum/RPM change that you have just made? Well you can.
By default yum/RPM do not save roll back information. This feature can easily be enabled by doing the following, however its not perfect and can use a lot of disk space as its repackaging the files whenever you do anything. Keep an eye on /var/spool/repackage to make sure its not growing too much.

/etc/yum.conf add the line:
tsflags=repackage

/etc/rpm/macros add the line:
(create this file if it doesnt exist)
%_repackage_all_erasures 1

Once this has been enabled, any install/update/erase you do through yum or RPM will save the roll back information, allowing you to easily roll back the transaction should something bad happen.

Examples:

rpm -Uhv –rollback ’14:00′
rpm -Uhv –rollback ’9 hours ago’
rpm -Uhv –rollback ‘december 12′
rpm -Uhv –rollback ‘yesterday’

You can leave a response, or trackback from your own site.

Leave a Reply