RPM has the ability to save datafiles before erasing them, permitting installations, updates, and removals to be undone through a rollback operation. Since it can take a substantial amount of space to save data necessary for a rollback, this feature is not enabled by default—but it’s well worth sacrificing some disk space in most cases.
In order to enable rollbacks, it is necessary to enable repackaging during the upgrading and removal of software. This can be enabled using command options, but the options have to be used consistently, and it’s easy to forget them. Therefore the best approach is to configure both rpm and yum to use repackaging all the time.
To configure rpm, create the file /etc/rpm/macros and place this line in it:
To configure yum, edit /etc/yum.conf and add the
tsflags (transaction set flags) line shown in bold here:
[main] cachedir=/var/cache/yum debuglevel=2 logfile=/var/log/yum.log pkgpolicy=newest distroverpkg=redhat-release tolerant=1 exactarch=1 retries=20 obsoletes=1 gpgcheck=1 exclude=*xorg* *xfree* *XFree* *kernel* tsflags=repackage # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d
tsflags line may appear anywhere after the
Once you have set this up, any package removal or upgrade (which is actually an installation and a removal performed together) will create a backup of the old data.
You can then roll back ...