Centos – Reinstalling YUM on CentOS via RPM

centosrpmyum

So, our server got into a complete meltdown. Random files are missing, an fsck fixed something out of any of the remaining files…and thanks to sysadmin's faulty backups, I ended up trying to recover a month's worth of work. Yay for me.

So, I managed to get PAM and root authentication working. Initial checking looks like most utils are up and running (including GCC), however, I had to rebuild RPM's db and YUM is in a pretty bad state (RPM, by the way, completely lost knowledge existing packages).

Currently, I'm in desperate need to get services up and running, and I was thinking on first getting YUM installing stuff correctly.

So, how do I install YUM over the net with RPM?

Server specs: i386 (i686 compatible)i686, HP blade, CentOS. Oh, and how do I get the CentOS version in Linux (cli)? CentOS 5.3 (final)

Best Answer

Somewhere in /etc/issue the version of CentOS you're dealing with will be shown, and the arch will come from uname -m.

As for yum itself, do not use rpm to reinstall it, but rather use rpm2cpio and cpio to extract the files from the packages and then let yum fix up the rpmdb after the fact. Download the yum and centos-release packages and then:

cd /
rpm2cpio /path/to/yum-....rpm | cpio -id
rpm2cpio /path/to/centos-release-....rpm | cpio -id

Repeat until you have all the packages needed to get yum back in place.