RedHat(小紅帽)下 yum用不了的解決辦法

  因爲RedHat是商業版的,一般因爲沒有註冊,致使yum程序沒法使用(linux下面,yum是個安裝軟件的「神器」)。此時可用CentOS的地址進行替換。下面將一步步說明如何處理:linux

1、刪除RedHat自帶的yum相關文件centos

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

  二、能夠經過FTP方式刪除,或者直接採用命令。url

  

2、從新配置yum相關文件spa

  一、配置yum.conf,建立yum.conf文件,再進行編輯便可;debug

  

  yum.conf內容,可直接拷貝,以下:   blog

[main]
cachedir=/var/cache/yum
keepcache=1
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
metadata_expire=1800

  粘貼完成後,保存後便可。可經過命令查看,是否一致。it

  

  二、配置rhel-debuginfo.repo,建立rhel-debuginfo.repo文件,再進行編輯便可(本文以CentOS5 64位地址爲準);io

  具體操做,同1,這裏只把內容展現以下:  function

[base]
name=centos-5 - Base
baseurl=http://centos.ustc.edu.cn/centos/5/os/x86_64/
# the other site:
# you can find more site in: ?id=13
enabled=1
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5
#released updates
[update]
name=CentOS-5 - Updates
baseurl=http://mirror.centos.org/centos/5/updates/x86_64/
gpgcheck=1
gpgkey=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 - Addons
baseurl=http://mirror.centos.org/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=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 - Extras
baseurl=http://mirror.centos.org/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
baseurl=http://mirror.centos.org/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
baseurl=http://mirror.centos.org/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5
#packages in testing
[testing]
name=CentOS-5 - Testing
baseurl=http://mirror.centos.org/centos/5/testing/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5

  備註:若是是32爲系統,只需把X86_64所有替換成i386便可。

相關文章
相關標籤/搜索