Redhat 使用CentOS的yum源进行升级或软件安装

 Redhat默认的源不但速度不给力,而且软件版本陈旧,今天试着将Redhat默认源替换为CentOS的163源,发现速度能达到2M/s左右,而且版本都比较新,非常给力,与大家分享!


(目前可以使用CentOS0-6.3软件仓库的软件)

1. 删除原有的yum源
  1. # rpm -aq | grep yum|xargs rpm -e --nodeps
2.下载新的yum安装包,这里使用centos-6.3

  1. # wget http://mirror.centos.org/centos/6.3/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
  2. # wget http://mirror.centos.org/centos/6.3/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
  3. # wget http://mirror.centos.org/centos/6.3/os/x86_64/Packages/yum-3.2.29-30.el6.centos.noarch.rpm
  4. # wget http://mirror.centos.org/centos/6.3/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
3.安装yum软件包

  1. #rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
  2. # rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
  3. #rpm -ivh yum-3.2.29-30.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
4. 更改yum源
/etc/yum.repos.d/新建文件centos.repo,内容如下:

  1. #########################################################################
  2. # CentOS-Base.repo
  3. #
  4. # The mirror system uses the connecting IP address of the client and the
  5. # update status of each mirror to pick mirrors that are updated to and
  6. # geographically close to the client. You should use this for CentOS updates
  7. # unless you are manually picking other mirrors.
  8. #
  9. # If the mirrorlist= does not work for you, as a fall back you can try the
  10. # remarked out baseurl= line instead.
  11. #
  12. #
  13. [base]
  14. name=CentOS-6 - Base - 163.com
  15. baseurl=http://mirrors.163.com/centos/6/os/$basearch/
  16. #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
  17. gpgcheck=1
  18. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
  19. #released updates
  20. [updates]
  21. name=CentOS-6 - Updates - 163.com
  22. baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
  23. #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
  24. gpgcheck=1
  25. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
  26. #additional packages that may be useful
  27. [extras]
  28. name=CentOS-6 - Extras - 163.com
  29. baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
  30. #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
  31. gpgcheck=1
  32. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
  33. #additional packages that extend functionality of existing packages
  34. [centosplus]
  35. name=CentOS-6 - Plus - 163.com
  36. baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
  37. #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
  38. gpgcheck=1
  39. enabled=0
  40. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
  41. #contrib - packages by Centos Users
  42. [contrib]
  43. name=CentOS-6 - Contrib - 163.com
  44. baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
  45. #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
  46. gpgcheck=1
  47. enabled=0
  48. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
  49. #########################################################################
5.清理yum缓存

  1. # yum clean all
  2. # yum makecache #将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度
  3. # yum install software_name #测试新源是否可用
6.更新系统

  1. #yum update -y
问题:
(1)如果出现域名不能解析的情况,添加nameserver 8.8.8.8到/etc/resolv.conf中即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值