I use a lot of VPS and often times, they don’t actually have yum to make my life easier. So here is a quick HOWTO on installing yum on a CentOS box. This assumes that you have rpm and wget already installed. Note: This will only work on CentOS 5.2 while the mirror is still active.
Run the following code in a temporary directory to download all the RPMs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #!/bin/bash for file in \ elfutils-0.125-3.el5.i386.rpm \ elfutils-libs-0.125-3.el5.i386.rpm \ expat-1.95.8-8.2.1.i386.rpm \ gmp-4.1.4-10.el5.i386.rpm \ libxml2-2.6.26-2.1.2.1.i386.rpm \ libxml2-python-2.6.26-2.1.2.1.i386.rpm \ m2crypto-0.16-6.el5.2.i386.rpm \ python-2.4.3-21.el5.i386.rpm \ python-elementtree-1.2.6-5.i386.rpm \ python-iniparse-0.2.3-4.el5.noarch.rpm \ python-sqlite-1.1.7-1.2.1.i386.rpm \ python-urlgrabber-3.1.0-2.noarch.rpm \ readline-5.1-1.1.i386.rpm \ rpm-4.4.2-48.el5.i386.rpm \ rpm-libs-4.4.2-48.el5.i386.rpm \ rpm-python-4.4.2-48.el5.i386.rpm \ sqlite-3.3.6-2.i386.rpm \ yum-3.2.8-9.el5.centos.1.noarch.rpm \ yum-metadata-parser-1.1.2-2.el5.i386.rpm do wget http://mirror.centos.org/centos-5/5.2/os/i386/CentOS/$file; done |
Once you have downloaded the necessary files. Install them all by typing:
1 | # rpm -Uvh *.rpm |
Then feel free to # yum -y update to bring your system up to date.

This is helpful, thanks!
Awesome! Thanks!
🙂
# yum update
Loading “fastestmirror” plugin
Determining fastest mirrors
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in ?
yummain.main(sys.argv[1:])
File “/usr/share/yum-cli/yummain.py”, line 105, in main
result, resultmsgs = base.doCommands()
File “/usr/share/yum-cli/cli.py”, line 289, in doCommands
self._getTs()
File “/usr/lib/python2.4/site-packages/yum/depsolve.py”, line 85, in _getTs
self._getTsInfo()
File “/usr/lib/python2.4/site-packages/yum/depsolve.py”, line 91, in _getTsInfo
self._tsInfo.setDatabases(self.rpmdb, self.pkgSack)
File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 537, in
pkgSack = property(fget=lambda self: self._getSacks(),
File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 392, in _getSacks
self.repos.populateSack(which=repos)
File “/usr/lib/python2.4/site-packages/yum/repos.py”, line 214, in populateSack
self.doSetup()
File “/usr/lib/python2.4/site-packages/yum/repos.py”, line 66, in doSetup
self.ayum.plugins.run(‘postreposetup’)
File “/usr/lib/python2.4/site-packages/yum/plugins.py”, line 169, in run
func(conduitcls(self, self.base, conf, **kwargs))
File “/usr/lib/yum-plugins/fastestmirror.py”, line 90, in postreposetup_hook
repomirrors[str(repo)] = FastestMirror(repo.urls).get_mirrorlist()
File “/usr/lib/yum-plugins/fastestmirror.py”, line 142, in get_mirrorlist
self._poll_mirrors()
File “/usr/lib/yum-plugins/fastestmirror.py”, line 155, in _poll_mirrors
pollThread.start()
File “/usr/lib/python2.4/threading.py”, line 416, in start
_start_new_thread(self.__bootstrap, ())
thread.error: can’t start new thread
Thanks very helpful. Tip for others:
# cat /etc/issue
CentOS release 5 (Final)
Gives your version. Mine was Version 5
do wget http://mirror.centos.org/centos-5/5.2/os/i386/CentOS/$file;
Change this line of the script to the correct version/path
i.e. I had to change /5.2/ to /5/ for version 5
Thx But now CentOS change url now http://vault.centos.org/5.2/os/i386/CentOS/$file;
Nice work eric. I myself bumped into this situation a few times. A small update. The mirror is no longer available. If you still wanna use 5.2 packages, use http://vault.centos.org/5.2/os/i386/CentOS/$file instead.
Nice work eric. I myself bumped into this situation a few times. A small update. The mirror is no longer available. If you still wanna use 5.2 packages, use http://vault.centos.org/5.2/os/i386/CentOS/$file instead.
Worked out well, except I had to manually run the rpm: yum-3.2.8-9.el5.centos.1.noarch.rpm for some reason.
links seems to be broken now. how i install yum now . will you direct me to the fresh links now. Thanks
Updated version, as of 5/14/2012 (I just updated it and used it a few minutes ago).
#!/bin/bashfor file in elfutils-0.137-3.el5.x86_64.rpm elfutils-libs-0.137-3.el5.x86_64.rpm expat-1.95.8-8.3.el5_5.3.x86_64.rpm gmp-4.1.4-10.el5.x86_64.rpm libxml2-2.6.26-2.1.12.el5_7.2.x86_64.rpm libxml2-python-2.6.26-2.1.12.el5_7.2.x86_64.rpm m2crypto-0.16-8.el5.x86_64.rpm python-2.4.3-46.el5.x86_64.rpm python-elementtree-1.2.6-5.x86_64.rpm python-iniparse-0.2.3-4.el5.noarch.rpm python-sqlite-1.1.7-1.2.1.x86_64.rpm python-urlgrabber-3.1.0-6.el5.noarch.rpm readline-5.1-3.el5.x86_64.rpm rpm-4.4.2.3-27.el5.x86_64.rpm rpm-libs-4.4.2.3-27.el5.x86_64.rpm rpm-python-4.4.2.3-27.el5.x86_64.rpm sqlite-3.3.6-5.x86_64.rpm yum-3.2.22-39.el5.centos.noarch.rpm yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm do wget http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/$file;done