RedHat用CentOS系统源

浏览次数:2368 关键词 ( 系统  RedHat  CentOS  )

RedHat 无法使用官方的更新源,于是不得不将RedHat的官方源替换成CentOS的开源源,下面是具体的操作步骤:

1、更换RedHat的yum程序:

 

[plain] view plaincopy在CODE上查看代码片派生到我的代码片  
  1. [root@leekwen]# cat /etc/issue  
  2. Red Hat Enterprise Linux Server release 5.5 (Tikanga)  
  3. Kernel \r on an \m  
  4.   
  5. [root@leekwen]# rpm -qa|grep yum  
  6. [root@leekwen]# rpm -e yum-3.2.22-20.el5 --nodeps  
  7. [root@leekwen]# rpm -e yum-updatesd-0.9-2.el5 --nodeps  
  8. [root@leekwen]# rpm -e yum-security-1.1.16-13.el5 --nodeps  
  9. [root@leekwen]# rpm -e yum-metadata-parser-1.1.2-3.el5 --nodeps  
  10. [root@leekwen]# rpm -e yum-rhn-plugin-0.5.4-13.el5 --nodeps  

2、下载CentOS的yum程序(这里我的是32bit的服务器,如果64位的,请自行修改下载路径):

 

 

[plain] view plaincopy在CODE上查看代码片派生到我的代码片  
  1. [root@leekwen]# wget -c http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm  
  2. [root@leekwen]# wget -c http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm  
  3. [root@leekwen]# wget -c http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-4.el5.i386.rpm  

3、安装CentOS的yum程序:

 

 

[plain] view plaincopy在CODE上查看代码片派生到我的代码片  
  1. [root@leekwen]# rpm -ivh yum-3.2.22-40.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm yum-metadata-parser-1.1.2-4.el5.i386.rpm  

 

4、修改CentOS的yum源:

 

[plain] view plaincopy在CODE上查看代码片派生到我的代码片  
  1. [root@leekwen]# cd /etc/yum.repos.d/  
  2. [root@leekwen]# cp rhel-debuginfo.repo rhel-debuginfo.repo.bak  
  3. [root@leekwen yum.repos.d]# echo > rhel-debuginfo.repo  
  4. [root@leekwen yum.repos.d]# cat rhel-debuginfo.repo  
  5. [base]  
  6. name=CentOS-5 - Base  
  7. repo=os  
  8. baseurl=http://centos.ustc.edu.cn/centos/5/os/$basearch/  
  9. gpgcheck=1  
  10. gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5  
  11. [update]  
  12. name=CentOS-5 - Updates  
  13. baseurl=http://centos.ustc.edu.cn/centos/5/updates/$basearch/  
  14. gpgcheck=1  
  15. gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5  
  16. [addons]  
  17. name=CentOS-5 - Addons  
  18. baseurl=http://centos.ustc.edu.cn/centos/5/addons/$basearch/  
  19. gpgcheck=1  
  20. gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5  
  21. [extras]  
  22. name=CentOS-5 - Extras  
  23. baseurl=http://centos.ustc.edu.cn/centos/5/extras/$basearch/  
  24. gpgcheck=1  
  25. gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5  
  26. [centosplus]  
  27. name=CentOS-5 - Plus  
  28. baseurl=http://centos.ustc.edu.cn/centos/5/centosplus/$basearch/  
  29. gpgcheck=1  
  30. enabled=0  
  31. gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5  
  32. [contrib]  
  33. name=CentOS-5 - Contrib  
  34. baseurl=http://centos.ustc.edu.cn/centos/5/contrib/$basearch/  
  35. gpgcheck=1  
  36. enabled=0  
  37. gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5  
  38. ###################  

5、执行yum升级即可:

 

 

[plain] view plaincopy在CODE上查看代码片派生到我的代码片  
  1. [root@leekwen]# yum update