1. Make sure that Yum is installed in rhel5.
[Root @ LVS-master ~] # Rpm-Qa | grep yum
Yum-metadata-parser-1.1.2-3.el5
Yum-updatesd-0.9-2.el5
Yum-3.2.22-26.el5
Yum-security-1.1.16-13.el5
Yum-rhn-plugin-0.5.4-15.el5
2. Modify the source configuration file # Vim/etc/yum. Repos. d/CentOS-Base.repo
[Base]
Name = CentOS-5-Base
# Items list = http://mirrorlist.centos.org /? Release = $ releasever5 & arch = $ basearch & repo = OS
# Baseurl = http://developer.centos.org/centos/?releasever/ OS /?basearch/
Baseurl = http://ftp.sjtu.edu.cn/centos/5/ OS /?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# Released updates
[Update]
Name = CentOS-5-Updates
# Items list = http://mirrorlist.centos.org /? Release = 4 & arch = $ basearch & repo = updates
Baseurl = http://ftp.sjtu.edu.cn/centos/5/updates/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# Packages used/produced in the build but not released
[Addons]
Name = CentOS-5-Addons
# Items list = http://mirrorlist.centos.org /? Release = 4 & arch = $ basearch & repo = Addons
Baseurl = http://ftp.sjtu.edu.cn/centos/5/addons/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# Additional packages that may be useful
[Extras]
Name = CentOS-5-Extras
# Items list = http://mirrorlist.centos.org /? Release = 4 & arch = $ basearch & repo = extras
Baseurl = http://ftp.sjtu.edu.cn/centos/5/extras/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# Additional packages that extend functionality of existing packages
[Centosplus]
Name = CentOS-5-Plus
# Items list = http://mirrorlist.centos.org /? Release = 4 & arch = $ basearch & repo = centosplus
Baseurl = http://ftp.sjtu.edu.cn/centos/5/centosplus/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# Contrib-packages by centos users
[Contrib]
Name = CentOS-5-Contrib
# Items list = http://mirrorlist.centos.org /? Release = 4 & arch = $ basearch & repo = contrib
Baseurl = http://ftp.sjtu.edu.cn/centos/5/contrib/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# Vi Dag. Repo
[Dag]
Name = Dag RPM repository for rhel5
Baseurl = http://ftp.riken.jp/linux/dag/redhat/el5/en/?basearch/dag/
Enabled = 1
Gpgcheck = 1
Gpgkey = http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt
3. Import key
# Rpm -- import http://ftp.sjtu.edu.cn/centos/5/ OS /i386/RPM-GPG-KEY-CentOS-5
4. Run and Test
# Yum update
5. # Yum clean all
Method 2:
#CD/etc/yum. Repos. d/
# Mv CentOS-Base.repo CentOS-Base.repo.bak
#Wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
The file content is as follows:
[Base]
CentOS-5-Base
Baseurl = http://centos.ustc.edu.cn/centos/5/ OS /?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
# Released updates
[Update]
CentOS-5-Updates
Baseurl = http://centos.ustc.edu.cn/centos/5/updates/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
# Packages used/produced in the build but not released
[Addons]
CentOS-5-Addons
Baseurl = http://centos.ustc.edu.cn/centos/5/addons/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
# Additional packages that may be useful
[Extras]
Name = CentOS-5-extras
Baseurl = http://centos.ustc.edu.cn/centos/5/extras/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
# Additional packages that extend functionality of existing packages
[Centosplus]
CentOS-5-plus
Baseurl = http://centos.ustc.edu.cn/centos/5/centosplus/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
# Contrib-packages by centos users
[Contrib]
Name = CentOS-5-contrib
Baseurl = http://centos.ustc.edu.cn/centos/5/contrib/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
# Packages in testing
[Testing]
CentOS-5-Testing
Baseurl = http://centos.ustc.edu.cn/centos/5/testing/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5