鱼C论坛

 找回密码
 立即注册
查看: 2405|回复: 0

RedHat 6.0使用CentOS YUM源更新的方法

[复制链接]
发表于 2011-12-10 06:16:38 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
 由于Redhat的yum在线更新是收费的,如果没有注册的话是不能使用的,即不能在线安装软件。在这种情况下,想使用Redhat系统,还想用yum源来在线安装软件,有没有办法?
  答案是有办法,请往下看!
1、删除redhat原有的yum源
  1. # rpm -aq | grep yum|xargs rpm -e --nodeps

复制代码

2、下载新的yum安装包   这里我们使用CentOS的yum源
  1. # wget http://mirror.centos.org/centos/6.0/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
  2. # wget http://mirror.centos.org/centos/6.0/os/i386/Packages/yum-metadata-parser-1.1.2-14.1.el6.i686.rpm
  3. # wget http://mirror.centos.org/centos/6.0/os/i386/Packages/yum-3.2.27-14.el6.centos.noarch.rpm
  4. # wget http://mirror.centos.org/centos/6.0/os/i386/Packages/yum-plugin-fastestmirror-1.1.26-1.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-14.1.el6.i686.rpm
  3. # rpm -ivh  yum-3.2.27-14.el6.centos.noarch.rpm  yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm
复制代码
注意:最后两个安装包要放在一起同时安装,否则会提示相互依赖,安装失败

4、更改yum源  #我们使用网易的CentOS镜像源

  1. # cd /etc/yum.repos.d/
  2. # wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo
  3. # vi CentOS6-Base-163.rep.noarch.rpm
复制代码
编辑文件,把文件里面的$releasever全部替换为版本号,即6 最后保存!或者直接把下面的内存拷贝到CentOS6-Base-163.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 vim* #测试域名是否可用
复制代码
温馨提示:163的版本不可以低于机器版本,要不是会出现问题的,最好可以用 Fedora的版本
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-3-28 18:06

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表