Adding Yum to CentOS 5

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.


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- \
        libxml2-python-2.6.26- \
        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 \
  do wget$file;

Once you have downloaded the necessary files. Install them all by typing:

# rpm -Uvh *.rpm

Then feel free to # yum -y update to bring your system up to date.

Posted in Misc. Tags: , , . 10 Comments »
  • Aleksey

    This is helpful, thanks!

  • Max M.

    Awesome! Thanks!


  • Tim

    # yum update
    Loading “fastestmirror” plugin
    Determining fastest mirrors
    Traceback (most recent call last):
    File “/usr/bin/yum”, line 29, in ?
    File “/usr/share/yum-cli/”, line 105, in main
    result, resultmsgs = base.doCommands()
    File “/usr/share/yum-cli/”, line 289, in doCommands
    File “/usr/lib/python2.4/site-packages/yum/”, line 85, in _getTs
    File “/usr/lib/python2.4/site-packages/yum/”, line 91, in _getTsInfo
    self._tsInfo.setDatabases(self.rpmdb, self.pkgSack)
    File “/usr/lib/python2.4/site-packages/yum/”, line 537, in
    pkgSack = property(fget=lambda self: self._getSacks(),
    File “/usr/lib/python2.4/site-packages/yum/”, line 392, in _getSacks
    File “/usr/lib/python2.4/site-packages/yum/”, line 214, in populateSack
    File “/usr/lib/python2.4/site-packages/yum/”, line 66, in doSetup‘postreposetup’)
    File “/usr/lib/python2.4/site-packages/yum/”, line 169, in run
    func(conduitcls(self, self.base, conf, **kwargs))
    File “/usr/lib/yum-plugins/”, line 90, in postreposetup_hook
    repomirrors[str(repo)] = FastestMirror(repo.urls).get_mirrorlist()
    File “/usr/lib/yum-plugins/”, line 142, in get_mirrorlist
    File “/usr/lib/yum-plugins/”, line 155, in _poll_mirrors
    File “/usr/lib/python2.4/”, 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$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

  • KLS

    Thx But now CentOS change url now$file;

  • Vishnu

    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$file instead.

  • Vishnu

    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$file instead.

  • JR

    Worked out well, except I had to manually run the rpm: yum-3.2.8-9.el5.centos.1.noarch.rpm for some reason.

  • Trex000

    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-         rpm-libs-         rpm-python-         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$file;done