Rollback package Installation or update on RedHat machine

Many times we require to rollback package installation or patch updates on RedHat linux machines.

We can achieve this by following below steps:

 

1.    To configure yum to repackage RPMs, add the line tsflags=repackage to /etc/yum.conf.

 

2.    To configure command-line rpm to do the same thing, add the line %_repackage_all_erasures 1 to /etc/rpm/macros.up2date

 

3.    Install, erase, and update packages to your heart’s content, using yum

 

4.    If/when you want to rollback to a previous state, perform an rpm update with the –rollback option followed by a date/time specifier (the rollback is time-based because packages affect each other’s configuration — if you removed package a, then b, then c, and then rolled back only package a, the configuration could be broken).

 

Some examples:

  • rpm -Uhv –rollback ‘9:00 am’
  • rpm -Uhv –rollback ‘4 hours ago’
  • rpm -Uhv –rollback ‘5 mins ago’
  • rpm -Uhv –rollback ‘december 25’

Repackaged files are stored in /var/spool/repackage.

Neelesh Gurjar has written 122 articles

Leave a Reply