Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is a pretty bad situation but as long as you have the command line tools available, you should be able to rescue the situation.

  1. Are you sure that you removed the "rpm" rpm? I know this might sound stupid but if you only messed up your $PATH variable then the solution would be much easier (try running /bin/rpm --version - if you get something like RPM-Version 4.8.0 rpm is still there.)
  2. Is your rpm database intact? Check if you have the __db.00* files in /var/lib/rpm/. If you did loose your rpm database I guess you should reinstall your system/restore from backup.

Instead of compiling from source I'd recommend getting the binary RPM for your CentOS version and extract it manually.

# execute all following commands as root, especially "cpio" at the end
cd /
rpm2cpio rpm-4.8.0-32.el6.x86_64.rpm | cpio -idmv

Now you should have an rpm command again.