Rollback an update using yum as follows. As an example, we will be using the install and rollback of the screen package.
Note that it is not possible to rollback selinux, selinux-policy-*, kernel, or glibc (dependencies of glibc such as gcc) packages to a previous version. Downgrading a system to a minor version is not recommended as this might leave the system in an undesired state.
- The screen tool can be installed and uninstalled using yum in the following example.
# yum install screen
- The next step is to locate the transaction ID for which a ‘undo’ is desired.
- The transaction ID we’re looking for is ‘8,’ so go ahead and undo the step. Use yum history info 8 before doing the undo if you want to view more details to make sure this is the transaction you want to undo.
- Enter the following command to undo transaction 8.
# yum history undo 8
It is always recommended to perform a full system backup before installing any update, and yum history is not intended to replace system backups.
It’s always a good idea to document the state of the system before and after patching. This should include using the --orphans, --problems, --dupes, and --leaves
flags with package-cleanup.
yum history undo
will require access to all earlier RPM versions; as a result, the system must have access to the older RPM versions.
It is suggested that you carefully review the output of package-cleanup --orphans
before doing updates to determine which currently installed RPMs are no longer available in the enabled repositories.
Using CentOS’s regular repositories shouldn’t be an issue because several RPM versions are kept in these places.
Check the yum output/logs for any messages and rpmnew, orig, save files created after making any RPM modifications.