1. 程式人生 > >redhat6.5更換為contos 的yum源

redhat6.5更換為contos 的yum源

redhat預設自帶的yum源需要註冊,才能更新,報錯:
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
可替換為centos對應的源。 操作如下:

1.檢查是否安裝yum包。檢視RHEL是否安裝了yum,若是安裝了,那麼又有哪些yum包:
rpm -qa |grep yum

2 刪除redhat自帶的yum包
rpm -qa|grep yum|xargs rpm -e –nodeps(不檢查依賴,直接刪除rpm包)
rpm -qa |grep yum (查詢確認)

這裡寫圖片描述

3.下載新的yum包。使用Centos6.5的yum包

1) 檢視版本號和系統類別:

    cat /etc/redhat-release
    arch

2)根據上一步,找到對應的yum包,然後下載。

3)執行:

    rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-3.2.29-60.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
    如果這一步報錯,大底如下:
        libc.so.6 is needed by yum-metadata-parser-1.1.2-16.el6.i686
        libc.so.6(GLIBC_2.0) is needed by yum-metadata-parser-1.1.2-16.el6.i686
        libc.so.6(GLIBC_2.1.3) is needed by yum-metadata-parser-1.1.2-16.el6.i686
        libglib-2.0.so.0 is needed by yum-metadata-parser-1.1.2-16.el6.i686
        libpthread.so.0 is needed by yum-metadata-parser-1.1.2-16.el6.i686
        libpython2.6.so.1.0 is needed by yum-metadata-parser-1.1.2-16.el6.i686
        libsqlite3.so.0 is needed by yum-metadata-parser-1.1.2-16.el6.i686
        libxml2.so.2 is needed by yum-metadata-parser-1.1.2-16.el6.i686
        libxml2.so.2(LIBXML2_2.4.30) is needed by yum-metadata-parser-1.1.2-16.el6.i686

則說明下載安裝的yum包與系統版本不匹配,需要重新下載安裝。另外,163映象站點對於6.0~6.5的資源均合併在6的目錄下。

4)更換yum源,將原有源刪除或備份到別的目下下:

    cd /etc/yum.repos.d/
    wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo
    vi CentOS6-Base-163.repo
    編輯檔案,把檔案裡面的$releasever全部替換為版本號:6(注意,不是6.5!)最後儲存!

vi 編輯器的替換命令
%s/releasever/6/g 替換每一行中所有 releasever 為 6

4.清除原有快取,重建快取:

clean all
yum makecache

5.更新系統:

yum update