首先将RHEL5自带的yum删除 ,RHEL5 使用centos5的源来更新更快些,以下都是centos的公网源在rhel上的配置使用

rpm -qa|grep yum

找到所有的yum软件包,使用命令

rpm -e yum-XXX --nodeps

接下来从科大的网站上下载 yum软件包

http://centos.ustc.edu.cn/centos/5.5/os/x86_64/CentOS/

yum-3.2.22-26.el5.centos.noarch.rpm

yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm

yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm 

yum-security-1.1.16-14.el5.centos.1.noarch.rpm

yum-updatesd-0.9-2.el5.noarch.rpm 

在超级用户下安装上述RPM包

现在进入

cd /etc/yum.repo.d/

备份rhel自带源

mv rhel-debuginfo.repo rhel-debuginfo.repo.bak

创建Centos科大源

将如下内容保存到CentosUSTC.repo

   
   
   
   
  1. [base]     
  2. name=CentOS-5.5 - Base     
  3. baseurl=http://centos.ustc.edu.cn/centos/5.5/os/$basearch/     
  4. gpgcheck=1     
  5. gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5    
  6. #released updates      
  7. [updates]     
  8. name=CentOS-5.5 - Updates     
  9. baseurl=http://centos.ustc.edu.cn/centos/5.5/updates/$basearch/     
  10. gpgcheck=1     
  11. gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5    
  12. #packages used/produced in the build but not released     
  13. [addons]     
  14. name=CentOS-5.5 - Addons     
  15. baseurl=http://centos.ustc.edu.cn/centos/5.5/addons/$basearch/     
  16. gpgcheck=1     
  17. gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5    
  18. #additional packages that may be useful     
  19. [extras]     
  20. name=CentOS-5.5 - Extras     
  21. baseurl=http://centos.ustc.edu.cn/centos/5.5/extras/$basearch/     
  22. gpgcheck=1     
  23. gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5    
  24. #additional packages that extend functionality of existing packages     
  25. [centosplus]     
  26. name=CentOS-5.5 - Plus     
  27. baseurl=http://centos.ustc.edu.cn/centos/5.5/centosplus/$basearch/     
  28. gpgcheck=1     
  29. enabled=0     
  30. gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5  

创建上交源,将如下内容复制到CentosSJTU.repo里 

   
   
   
   
  1. [base]      
  2. name=CentOS-5 - Base     
  3. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&      
  4. repo=os     
  5. #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/      
  6. baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/      
  7. gpgcheck=1      
  8. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5     
  9. #released updates      
  10. [update]      
  11. name=CentOS-5 - Updates     
  12. #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates      
  13. baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/      
  14. gpgcheck=1      
  15. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5     
  16. #packages used/produced in the build but not released      
  17. [addons]      
  18. name=CentOS-5 - Addons     
  19. #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons      
  20. baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/      
  21. gpgcheck=1      
  22. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5     
  23. #additional packages that may be useful      
  24. [extras]      
  25. name=CentOS-5 - Extras     
  26. #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras      
  27. baseurl=http://ftp.sjtu.edu.cn/centos/5/extras/$basearch/      
  28. gpgcheck=1      
  29. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5     
  30. #additional packages that extend functionality of existing packages      
  31. [centosplus]      
  32. name=CentOS-5 - Plus     
  33. #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus      
  34. baseurl=http://ftp.sjtu.edu.cn/centos/5/centosplus/$basearch/      
  35. gpgcheck=1      
  36. enabled=0      
  37. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5     
  38. #contrib - packages by Centos Users      
  39. [contrib]      
  40. name=CentOS-5 - Contrib     
  41. #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib      
  42. baseurl=http://ftp.sjtu.edu.cn/centos/5/contrib/$basearch/      
  43. gpgcheck=1      
  44. enabled=0      
  45. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5    
  46. # vi dag.repo    
  47. #[dag]    
  48. #name=Dag RPM Repository for RHEL5    
  49. #baseurl=http://ftp.riken.jphttp://Linux.bitscn.com/dag/redhat/el5/en/$basearch/dag/    
  50. #enabled=1    
  51. #gpgcheck=1    
  52. #gpgkey=http://ftp.riken.jphttp://Linux.bitscn.com/dag/packages/RPM-GPG-KEY.dag.txt

创建163的源163.repo

   
   
   
   
  1. [base]     
  2. name=CentOS-5.5 - Base     
  3. baseurl=http://mirrors.163.com/centos/5.5/os/$basearch/     
  4. gpgcheck=1     
  5. gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5     
  6. [update]     
  7. name=CentOS-5.5 - Updates     
  8. baseurl=http://mirrors.163.com/centos/5.5/updates/$basearch/     
  9. gpgcheck=1     
  10. gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5     
  11. [extras]     
  12. name=CentOS-5.5 - Extras     
  13. baseurl=http://mirrors.163.com/centos/5.5/extras/$basearch/     
  14. gpgcheck=1     
  15. gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5     
  16. [addons]     
  17. name=CentOS-5.5 - Addons     
  18. baseurl=http://mirrors.163.com/centos/5.5/addons/$basearch/     
  19. gpgcheck=1     
  20. gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5     
  21. [centosplus]     
  22. name=CentOS-5.5 - Plus     
  23. baseurl=http://mirrors.163.com/centos/5.5/centosplus/$basearch/     
  24. gpgcheck=1     
  25. enabled=0     
  26. gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5  

 配置好源后,执行 yum update