undo redo yum commands

How to Undo or Redo Yum Install in RHEL/CentOS/Fedora

Yum is the default package manager of every Redhat/CentOS/Fedora Linux system. Starting version 3.2.25, Yum offers yum history command that allows you to easily review all the past yum commands that have been run on your system. It allows you to view the date & time, no. of installed packages, and execution status of all past Yum commands on your system. You can also use Yum history to redo or undo an installation on Redhat/CentOS/Fedora system. In this article, we will learn how to do this.


How to Undo or Redo Yum Install in RHEL/CentOS/Fedora

First of all, you should run yum history command as root or sudo to review the transaction history.

$ sudo yum history  
OR
$ sudo yum history list all

The above command’s output will show transaction ID, the command line, date and time, action and more, for each yum command that you have run. Here is an example.

In order to undo a yum install command, note the transaction ID (1st column above) and run the following command. Here is the command to undo yum installation with transaction ID 46.

$ sudo yum history undo 46

Similarly, in order to redo a yum install, note its transaction ID and run the following command. Here is an example to redo transaction with ID 45.

$ sudo yum history redo 45

You can use the above commands to not only undo/redo yum install but also yum remove commands.

If you want to remove an entry from yum history, you can also use yum remove/erase commands followed by the transaction ID.

Yum history is a very useful command that allows you to easily redo a past command, if you don’t know the exact package name used for installation. You can also use it to undo any accidental installations done in the past. You can also pipe its output to grep command to search for specific commands that you may want to use again.

Also read:

How to Fix Passwd Authentication Token Manipulation Error
How to Create Multiple User Accounts in Linux
How to Find PHP.ini
How to Delete Rows from Dataframe in Python
How to Iterate Rows in Pandas Dataframe

Leave a Reply

Your email address will not be published. Required fields are marked *