posts - 64,comments - 22,trackbacks - 0

          轉(zhuǎn)自:http://elf8848.iteye.com/blog/455676

          如何修改Centos yum源

          --------------------------------------
          國內(nèi)yum源: 163和搜狐的yum源。
          本文章介紹的yum源支持的版本是CentOS 5系列,理論上支持RHEL5系列。

          更新方法如下:

          先進(jìn)入yum源配置目錄
          cd /etc/yum.repos.d

          備份系統(tǒng)自帶的yum源
          mv CentOS-Base.repo CentOS-Base.repo.save

          下載其他更快的yum源
          中科大的yum源:(現(xiàn)在打不開了 )
          wget http://centos.ustc.edu.cn/CentOS-Base.repo

          163的yum源:
          wget http://mirrors.163.com/.help/CentOS-Base-163.repo
          修改CentOS-Base.repo (不修改會報錯),下載到本地把“$releasever”,替換成“5”

          sohu的yum源
          wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo

          更新玩yum源后,建議更新一下,使操作立即生效
          yum makecache




          RedHat5.6使用CentOS yum源更新的方法
          ================================================================================

          由于RedHat的yum在線更新是收費(fèi)的,我們的RedHat沒有注冊,不能在線更新下載rpm包。
          需將RedHat的yum卸載后,重啟安裝Centos的yum,再配置其他yum源。



          一、確認(rèn)RedHat的版本
          cat /etc/redhat-release
          uname -m

          二、刪除redhat原有的yum源
          rpm -aq|grep yum|xargs rpm -e --nodeps

          三、下載CentOS的yum安裝包(163源) (可以在這里手工找rpm包:http://mirrors.163.com/centos/)
          32位系統(tǒng):
          wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
          wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm
          wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
          64位系統(tǒng):
          wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
          wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm
          wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm

          還依賴python-iniparse-0.2.3-4.el5.noarch.rpm,
          但我的系統(tǒng)里已安裝了,是系統(tǒng)默認(rèn)Python2.4中自帶的。
          如果你的系統(tǒng)沒有安裝,請安裝吧。

          四、安裝yum軟件包
          32位系統(tǒng):
          rpm -ivh yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
          rpm -ivh yum-3.2.22-39.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
          注意:最后兩個安裝包要放在一起同時安裝,否則會提示相互依賴,安裝失敗。

          64位系統(tǒng):
          rpm -ivh yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
          rpm -ivh yum-3.2.22-39.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
          注意:最后兩個安裝包要放在一起同時安裝,否則會提示相互依賴,安裝失敗。


          五、更改yum源 #我們使用網(wǎng)易的CentOS鏡像源
          cd /etc/yum.repos.d/
          vi CentOS6-Base-163.repo
          # 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-5 - Base - 163.com
          mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=os
          baseurl=http://mirrors.163.com/centos/5/os/$basearch/
          gpgcheck=1
          gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

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

          #packages used/produced in the build but not released
          [addons]
          name=CentOS-5 - Addons - 163.com
          mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=addons
          baseurl=http://mirrors.163.com/centos/5/addons/$basearch/
          gpgcheck=1
          gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

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

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

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



          六、清理
          yum clean all
          yum makecache

          如果報錯:imary.sqlite.bz2 from base: [Errno 256] No more mirrors to try.
          執(zhí)行:yum makecache







          七、更新

          cd /etc/pki/rpm-gpg
          wget http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

          yum update



          很長時間的下載后,報錯:

          warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
          GPG key retrieval failed: [Errno 5] OSError: [Errno 2] No such file or directory: '/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5'
          這是因?yàn)椋褐付ǖ奈募?etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5在本地不存在導(dǎo)致的。

          解決:
          去官網(wǎng)http://mirror.centos.org/centos/下載相應(yīng)文件
          cd /etc/pki/rpm-gpg
          wget http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

          ================================================================================




          RedHat6.0使用CentOS yum源更新的方法
          --------------------------------------------------------------------

          由于RedHat的yum在線更新是收費(fèi)的,我們的RedHat沒有注冊,不能在線更新下載rpm包。
          需將RedHat的yum卸載后,重啟安裝Centos的yum,再配置其他yum源。


          一、確認(rèn)RedHat的版本
          cat /etc/redhat-release
          uname -m

          二、刪除redhat原有的yum源
          rpm -aq|grep yum|xargs rpm -e --nodeps

          三、下載CentOS的yum安裝包(163源)
          32位系統(tǒng) :
          wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-3.2.29-22.el6.centos.noarch.rpm
          wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm
          wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-10.el6.noarch.rpm
          wget http://mirrors.163.com/centos/6/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

          四、安裝yum軟件包
          rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
          rpm -ivh yum-metadata-parser-1.1.2-16.el6.i686.rpm
          rpm -ivh yum-3.2.29-22.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-10.el6.noarch.rpm
          注意:最后兩個安裝包要放在一起同時安裝,否則會提示相互依賴,安裝失敗。

          五、更改yum源 #我們使用網(wǎng)易的CentOS鏡像源
          cd /etc/yum.repos.d/
          vi CentOS6-Base-163.repo
          # 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


          六、清理
          yum clean all
          yum makecache

          如果報錯:imary.sqlite.bz2 from base: [Errno 256] No more mirrors to try.
          執(zhí)行:yum makecache

          至此,Redhat6可以使用CentOS的yum源在線安裝軟件了!
          posted on 2013-10-23 13:39 hellxoul 閱讀(1010) 評論(0)  編輯  收藏 所屬分類: linux

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 普兰店市| 阳信县| 邮箱| 桐柏县| 南阳市| 崇信县| 江陵县| 棋牌| 陕西省| 新疆| 开化县| 宁德市| 新余市| 浦江县| 敦煌市| 黔西| 青铜峡市| 大埔区| 彝良县| 万源市| 泸溪县| 五大连池市| 定陶县| 富蕴县| 江安县| 漠河县| 黄大仙区| 天等县| 邵东县| 明水县| 洛隆县| 扎兰屯市| 达州市| 博客| 高淳县| 东莞市| 聂荣县| 罗甸县| 沽源县| 凤城市| 永修县|