1. Ensure that Yum is installed in the RHEL5
[Email protected] ~]# 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
#mirrorlist =http://mirrorlist.centos.org/?release= $releasever 5&arch= $basearch &repo=os
#baseurl =http://mirror.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
#mirrorlist =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 and not released
[Addons]
Name=centos-5-addons
#mirrorlist =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 could be useful
[Extras]
Name=centos-5-extras
#mirrorlist =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
#mirrorlist =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
#mirrorlist =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, test
#yum Update
5. #yum Clean All
Method Two:
# cd/etc/yum.repos.d/
#mv Centos-base.repo Centos-base.repo.bak
#wget Http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
The contents of the document are as follows:
[Base]
Name=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]
Name=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 and not released
[Addons]
Name=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 could 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]
Name=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]
Name=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
Yum Source configuration under Linux