由于CentOS是从Redhat演化而来的免费Linux版本,因此可以利用CentOS的yum更新源来实现RHEL5的YUM功能。配置方法如下:

检查yum是否安装,默认情况下都是安装好的,总共4各包。


  1. [root@linux-a ~]# rpm -qa |grep yum

  2. yum-metadata-parser-1.0-8.fc6

  3. yum-3.0.1-5.el5

  4. yum-rhn-plugin-0.4.3-1.el5

  5. yum-updatesd-3.0.1-5.el5



配置yum更新源

创建/etc/yum.repos.d/CentOS-Base.repo文件,定义yum更新源,这里使用的是上海交大的CentOS更新源


  1. [root@linux-a ~]# vi /etc/yum.repos.d/CentOS-Base.repo  

  2. [base]

  3. name=centos-5 - Base

  4. baseurl=http://centos.ustc.edu.cn/centos/5/os/i386/

  5. # the other site: http://centos.candishosting.com.cn/centos/5/os/i386/

  6. # you can find more site in: http://www.centos.org/modules/tinycontent/index.php?id=13

  7. enabled=1

  8. gpgcheck=1

  9. gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

  10. #released updates

  11. [update]

  12. name=CentOS-5 - Updates

  13. baseurl=http://mirror.centos.org/centos/5/updates/i386/

  14. gpgcheck=1

  15. gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

  16. #packages used/produced in the build but not released

  17. [addons]

  18. name=CentOS-5 - Addons

  19. baseurl=http://mirror.centos.org/centos/5/addons/$basearch/

  20. gpgcheck=1

  21. gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

  22. #additional packages that may be useful

  23. [extras]

  24. name=CentOS-5 - Extras

  25. baseurl=http://mirror.centos.org/centos/5/extras/$basearch/

  26. gpgcheck=1

  27. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

  28. #additional packages that extend functionality of existing packages

  29. [centosplus]

  30. name=CentOS-5 - Plus

  31. baseurl=http://mirror.centos.org/centos/5/centosplus/$basearch/

  32. gpgcheck=1

  33. enabled=0

  34. gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

  35. #contrib - packages by Centos Users

  36. [contrib]

  37. name=CentOS-5 - Contrib

  38. baseurl=http://mirror.centos.org/centos/5/contrib/$basearch/

  39. gpgcheck=1

  40. enabled=0

  41. gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

  42. #packages in testing

  43. [testing]

  44. name=CentOS-5 - Testing

  45. baseurl=http://mirror.centos.org/centos/5/testing/$basearch/

  46. gpgcheck=1

  47. enabled=0

  48. gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5


导入key

  1. [root@linux-a ~]# rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5