Using PuTTy login to your CentOS as root. Then apply the command as listed below.

nano /etc/yum.repos.d/CentOS-Base.repo

As you may know that CentOS version 5 will no longer supported. The CentOS 5 version is already deprecated from Linux platform. But if you still needed to stay on CentOS 5 version, you sure can. And you have to edit your CentOS 5 repo file to get updates from CentOS archive named “Vault”.

Do the repo update by delete all content from the repo file, and paste the below content:

# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/5.11/os/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos

#released updates
enabled=1

[updates]
name=CentOS-$releasever - Updates
baseurl=http://vault.centos.org/5.11/updates/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos

#packages used/produced in the build but not released
enabled=1

[addons]
name=CentOS-$releasever - Addons
baseurl=http://vault.centos.org/5.11/addons/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos

#additional packages that may be useful
enabled=1

[extras]
name=CentOS-$releasever - Extras
baseurl=http://vault.centos.org/5.11/extras/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos

#additional packages that extend functionality of existing packages
enabled=1

[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://vault.centos.org/5.11/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://vault.centos.org/5.11/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5

Save and exit the file.

Clean the cache:

yum -y clean all

Then update your CentOS 5, and reboot the system.

yum -y update
reboot

Use your CentOS 5 for longer years. Done.

Enjoy !