MyOra asked:

I removed all the packages in CentOS by chance using yum remove mktemp removed almost all the bin packages including rpm and openssh. The terminal that I’m connected is the only one which is the gate for me. If I disconnect I can’t do ssh too. Any way to roll it back and get the packages installed.? Please help!!

My answer:

How did you manage to do that? I can’t reproduce this on CentOS 6; the following error occurs (after several seconds of listing all the packages it’s going to remove, which should have been a clue):

Error: Trying to remove "yum", which is protected

Anyway, on with the answer…

If you somehow still have yum on your system, and it somehow still works, you can view the history and undo the most recent transaction:

yum history

will show your most recent transactions, each with a number, and then

yum history undo ###

will undo the transaction listed.

If you don’t have a working yum on your system, then you’ve damaged it beyond reasonable repair and should restore from backup.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.