How to Undo or Redo a Yum Install on CentOS and RHEL

One of the most important and useful feature added to YUM Package Manager (from version 3.2.25) is the ‘yum history’ command. It allows you to review a full history of yum transactions that have been run on a system.

It shows the dates and times when a transactions were performed, whether the transactions succeeded or were aborted, the number of packages affected, and so much more.

Importantly, yum history can be used to undo or redo certain transactions. In this article, we will show how to undo or redo a yum install including dependencies on a CentOS/RHEL distribution.

To do this, first you need to review the yum transactions history by running the following command as root user, otherwise use the sudo command to gain root privileges.

$ sudo yum history  
OR
$ sudo yum history list all
List Yum History
List Yum History

From the output in the screenshot above, the yum history shows you the transaction ID, the command line, date and time, action and more.

To undo a yum install, take note of the transaction ID, and perform the required action. In this example, we want to undo the install with ID 63, which will erase the package that was installed in the specified transaction, as follows (enter y/yes when asked).

$ sudo yum history undo 63
Undo Yum Install Package
Undo Yum Install Package

To redo a yum install, as before, take note of the transaction ID, and run it. For instance to redo the install with ID 63, run the the following command.

$ sudo yum history redo 63

Note that you can do the same for a yum remove/erase transaction. The most important thing to note is the transaction ID of an yum install or yum remove action.

For more information about yum history, see this guide:

  1. How to Use ‘Yum History’ to Find Out Installed or Removed Packages Info

That’s all for now! In this article, we demonstrated how to undo or redo a yum install including dependencies on CentOS/RHEL. Share your thoughts with us via the comment form below.

If you read this far, tweet to the author to show them you care. Tweet a thanks
Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.