Redhat修改yum配置使用CentOS的源

因爲 redhat的yum在線更新是收費的,若是沒有註冊的話不能使用,若是要使用,需將redhat的yum卸載後,重啓安裝,再配置其餘源,如下爲詳細過程:  node


1.刪除redhat原有的yum 
rpm -aq|grep yum|xargs rpm -e --nodeps 

2.下載yum安裝文件 
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm 
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm 
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm 
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm 

3.進行安裝yum 

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm 
rpm -ivh yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm 
rpm -ivh yum-3.2.27-14.el6.centos.noarch.rpm um-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm  
注意最後兩個包必需同時安裝,不然會相互依賴 

4.更新repo文件
python

mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.repo.bak vim

vi /etc/yum.repos.d/rhel-debuginfo.repo centos

內容爲: 測試

[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos/6.0/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/6.0/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#packages used/produced in the build but not released
#[addons]
#name=CentOS-$releasever - Addons
#baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
#gpgcheck=1
#gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/6.0/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/6.0/centosplus/$basearch/
gpgcheck=1
enabled=0
ui

五、yum clean all  this

六、yum install vim #測試一下可不能夠用 url


【設置本地鏡像做爲yum源】 spa

一、mkdir /mnt/cdrom .net

2   mount /dev/cdrom /mnt/cdrom  #掛着鏡像,光盤

3  mkdir /home/redhat-iso

4  cp -Rf /mnt/cdrom/* /home/redhat-iso   #將光盤內的內容copy到某個路徑下

5  vi /etc/yum.repos.d/rhel-debuginfo.repo  #編輯repo文件

添加一下內容:

[rhel_6_iso]
name=local iso 
baseurl=file:///home/redhat-iso/
gpgcheck=1
gpgkey=file:///home/redhat-iso/RPM-GPG-KEY-CentOS-6 #該處的gpgkey文件應該改爲iso鏡像中的文件名

注意:

RHA5上用yum安裝程序時候,出現下面的異常問題:
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
  
RHA5

解決辦法:

rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5


若是是低版本,能夠使用

rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-centos4
相關文章
相關標籤/搜索