RHEL6解決無法使用YUM源問題

在安裝了RHEL6之後,需要安裝oracle12c(後面會把安裝的步驟整理出來)  ,但是RHEL的YUM源需要註冊用戶才能更新使用,redhat的yum源是需要註冊付費的  ,由於CentOS和RHEL基本沒有區別,並且CentOS已經被REHL收購。所以將RHEL的YUM源替換爲CentOS即可。

按下面的步驟

1.清除原有RHEL的YUM及相關軟件包。

rpm -qa | grep yum | xargs rpm -e --nodeps


2.下載centos6的相關軟件包
wget https://mirrors.edge.kernel.org/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm  
wget https://mirrors.edge.kernel.org/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm 
wget https://mirrors.edge.kernel.org/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm

wget https://mirrors.edge.kernel.org/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm


*註釋:這些軟件包的具體的版本,請到http://mirrors.163.com/centos/6/os/x86_64/Packages/ 目錄下,選擇下載上述軟件包。網上很多文章沒法直接使用就是因爲軟件包的版本問題。


3.安裝軟件包。
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm  
rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm   yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm python-urlgrabber-3.9.1-11.el6.noarch.rpm

*註釋yum-plugin-fastestmirror和yum-3.2.29要一起安裝



如果按照遇到問題:發現錯誤,python-urlgrabber版本必須大於等於3.9.1-10
 # rpm -ivh  yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
warning: yum-3.2.29-73.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
    python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-73.el6.centos.noarch
查看系統的python信息
# rpm -qa|grep python
發現python-urlgrabber-3.9.1-9.el6.noarch 版本低於3.9.1-10 
卸載:python-urlgrabber-3.9.1-9.el6.noarch
 rpm -e python-urlgrabber-3.9.1-9.el6.noarch

安裝:rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm



3.更換yum源,使用163的源 (wget http://mirrors.163.com/.help/CentOS6-Base-163.repo)

打開http://mirrors.163.com/.help/centos.html,在裏面下載對應版本的repo文件,比如我下載的是CentOS6-Base-163.repo文件,然後把它放到/etc/yum.repos.d/下。還需要打開CentOS6-Base-163.repo文件修改$releasever爲版本號6

已經修改後的文件內容如下:






# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#




[base]
name=CentOS-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6




#released updates 
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6




#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6




#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6




#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6




4.清除原有緩存


使用命令 yum clean all 清除原來的緩存。






5.重新建立緩存


 使用命令 yum makecache 重建緩存。



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章