We were trying to reinstall the Munin package last week in one of our production servers and I somehow managed to screw things up. I accidentally removed rpm
(and since yum
depends on it, it was removed also!). And since yum
and rpm
are now gone, we can’t install anything! Cr*p!
Desperate times indeed. Luckily, Google search somehow pointed me in the right direction. I stumbled on this site, [www.thedumbterminal.co.uk] and it gave me the answer that I was looking for 🙂
NOTE: Check first if what version of CentOS do you have and what architecture. URLs must be changed if you’re not using CentOS 4.1
These are the commands that I executed in shell:
$ mkdir /tmp/install && cd /tmp/install
$ wget -c http://vault.centos.org/4.1/os/i386/CentOS/RPMS/rpm-4.3.3-9_nonptl.i386.rpm
$ rpm2cpio rpm-4.3.3-9_nonptl.i386.rpm | cpio -dim
$ find . -type d -exec chmod 755 {} \;
$ tar cf - ./usr ./etc ./bin | (cd /; tar xvf -)
$ rpm --rebuilddb
$ rpm -i rpm-4.3.3-9_nonptl.i386.rpm
In the last line (above), rpm
has to be re-installed to update the package version in CentOS db. rpm
won’t install a .rpm package otherwise. You have to copy the rpm2cpio
command from other existing CentOS/RHEL installations if you can’t find/run it.
To re-install yum
, I ran these commands:
$ wget -c http://vault.centos.org/4.1/os/i386/CentOS/RPMS/yum-2.2.1-1.centos4.noarch.rpm
$ wget -c http://vault.centos.org/4.1/os/i386/CentOS/RPMS/rpm-python-4.3.3-9_nonptl.i386.rpm
$Â rpm -i rpm-python-4.3.3-9_nonptl.i386.rpm
$Â rpm -i yum-2.2.1-1.centos4.noarch.rpm
And that’s how I cleaned-up my mess. And yes, the server is running CentOS 4.1 🙂