你的位置:首页 > 操作系统

[操作系统]RedHat(小红帽)下 yum用不了的解决办法


  由于RedHat是商业版的,通常由于没有注册,导致yum程序无法使用(linux下面,yum是个安装软件的“神器”)。此时可用CentOS的地址进行替换。下面将一步步说明如何处理:

一、删除RedHat自带的yum相关文件

  1、文件位置:/etc/yum.conf和/etc/yum.repo.d/rhel-debuginfo.repo;

  2、可以通过FTP方式删除,或者直接采用命令。

  

二、重新配置yum相关文件

  1、配置yum.conf,创建yum.conf文件,再进行编辑即可;

  

  yum.conf内容,可直接拷贝,如下:   

[main]cachedir=/var/cache/yumkeepcache=1debuglevel=2logfile=/var/log/yum.logpkgpolicy=newestdistroverpkg=redhat-releasetolerant=1exactarch=1obsoletes=1gpgcheck=1plugins=1metadata_expire=1800

  粘贴完成后,保存后即可。可通过命令查看,是否一致。

  

  2、配置rhel-debuginfo.repo,创建rhel-debuginfo.repo文件,再进行编辑即可(本文以CentOS5 64位地址为准);

  具体操作,同1,这里只把内容展示如下:  

[base]name=centos-5 - Basebaseurl=http://centos.ustc.edu.cn/centos/5/os/x86_64/# the other site:# you can find more site in: ?id=13enabled=1gpgcheck=1gpgkey=http://centos.ustc.edu.cn/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5#released updates[update]name=CentOS-5 - Updatesbaseurl=http://mirror.centos.org/centos/5/updates/x86_64/gpgcheck=1gpgkey=http://centos.ustc.edu.cn/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5#packages used/produced in the build but not released[addons]name=CentOS-5 - Addonsbaseurl=http://mirror.centos.org/centos/5/addons/$basearch/gpgcheck=1gpgkey=http://centos.ustc.edu.cn/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5#additional packages that may be useful[extras]name=CentOS-5 - Extrasbaseurl=http://mirror.centos.org/centos/5/extras/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4#additional packages that extend functionality of existing packages[centosplus]name=CentOS-5 - Plusbaseurl=http://mirror.centos.org/centos/5/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=http://centos.ustc.edu.cn/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5#contrib - packages by Centos Users[contrib]name=CentOS-5 - Contribbaseurl=http://mirror.centos.org/centos/5/contrib/$basearch/gpgcheck=1enabled=0gpgkey=http://centos.ustc.edu.cn/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5#packages in testing[testing]name=CentOS-5 - Testingbaseurl=http://mirror.centos.org/centos/5/testing/$basearch/gpgcheck=1enabled=0gpgkey=http://centos.ustc.edu.cn/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5

  备注:如果是32为系统,只需把X86_64全部替换成i386即可。