redhat配置centos的yum源

來源:互聯網
上載者:User

標籤:centos源   rhel   yum源   

     redhat預設不支援第三方的yum源,要求有rhn帳號,下面就rhel5和rhel6改為centos源

一、rhel5.5 X86_64更改為centos的yum源

查看系統內建的yum相關的rpm包

 rpm -qa|grep yum

刪掉系統內建的yum相關的包

rpm -e --nodeps yum-updatesd-0rpm -e --nodeps yum-security  rpm -e --nodeps yum-metadata-prpm -e --nodeps yum-rhn-plugin

安裝163yum包,三個yum包有依賴關係,需要一起安裝

wget  http://mirrors.163.com/centos/5/os/x86_64/CentOS/python-iniparse-0.2.3-6.el5.noarch.rpm    wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpmwget          wget rpm -ivh python-iniparse-0.2.3-6.el5.noarch.rpm  rpm -ivh  yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm yum-3.2.22-40.el5.centos.noarch.rpm yum-metadata-parser-1.1.2-4.el5.x86_64.rpm

在/etc/yum.repos.d下將原有的repo檔案重新命名,建立一個Base.repo

[base]name=Red Hat Enterprise Linux $releasever - Basebaseurl=http://mirror.centos.org/centos/5/os/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #released updates[updates]name=Red Hat Enterprise Linux $releasever - Updatesbaseurl=http://mirror.centos.org/centos/5/updates/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released[addons]name=Red Hat Enterprise Linux $releasever - Addonsbaseurl=http://mirror.centos.org/centos/5/addons/$basearch/pgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful[extras]name=Red Hat Enterprise Linux $releasever - Extrasbaseurl=http://mirror.centos.org/centos/5/extras/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages[centosplus]name=Red Hat Enterprise Linux $releasever - Plusbaseurl=http://mirror.centos.org/centos/5/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users[contrib]name=Red Hat Enterprise Linux $releasever - Contribbaseurl=http://mirror.centos.org/centos/5/contrib/$basearch/gpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

這裡也可以使用mirrors.163.com或者mirrors.aliyun.com的yum源, rhel6則以163yum源為例,匯入key

rpm --import http://mirror.centos.org/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5

產生緩衝

yum clean allyum makecache

如果配置成功則會提示載入成功


二、redhat6.4 X86_64更改為centos的yum源

刪除原有的yum相關的rpm包

 rpm -qa|grep yum rpm -e --nodeps yum-rhn-plugin rpm -e --nodeps yum-metadata-parser rpm -e --nodeps yum-utils rpm -e --nodeps yum-plugin-security rpm -e --nodeps rhn-check

下載安裝包並安裝

mkdir -p /server/tools cd /server/tools/ wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-69.el6.centos.noarch.rpm wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm  rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm  rpm -ivh yum-3.2.29-69.el6.centos.noarch.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

重新命名原有內建的repo檔案,並下載163的repo檔案

 cd /etc/yum.repos.d/ mv rhel-source.repo rhel-source.repo.bak wget http://mirrors.163.com/.help/CentOS6-Base-163.repo rpm --import http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6 sed -i ‘s#$releasever#6#g‘ CentOS6-Base-163.repo

清空緩衝,並重建

 yum clean all yum makecache

如果配置阿里的yum源,則可以加入如下命令

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

至此rhel6配置centos源配置完成

redhat配置centos的yum源

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.