posts - 64,comments - 22,trackbacks - 0

          轉自:http://elf8848.iteye.com/blog/455676

          如何修改Centos yum源

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

          更新方法如下:

          先進入yum源配置目錄
          cd /etc/yum.repos.d

          備份系統自帶的yum源
          mv CentOS-Base.repo CentOS-Base.repo.save

          下載其他更快的yum源
          中科大的yum源:(現在打不開了 )
          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在線更新是收費的,我們的RedHat沒有注冊,不能在線更新下載rpm包。
          需將RedHat的yum卸載后,重啟安裝Centos的yum,再配置其他yum源。



          一、確認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位系統:
          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位系統:
          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,
          但我的系統里已安裝了,是系統默認Python2.4中自帶的。
          如果你的系統沒有安裝,請安裝吧。

          四、安裝yum軟件包
          32位系統:
          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位系統:
          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源 #我們使用網易的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.
          執行: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'
          這是因為:指定的文件/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5在本地不存在導致的。

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

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




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

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


          一、確認RedHat的版本
          cat /etc/redhat-release
          uname -m

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

          三、下載CentOS的yum安裝包(163源)
          32位系統 :
          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源 #我們使用網易的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.
          執行:yum makecache

          至此,Redhat6可以使用CentOS的yum源在線安裝軟件了!
          posted on 2013-10-23 13:39 hellxoul 閱讀(1010) 評論(0)  編輯  收藏 所屬分類: linux
          主站蜘蛛池模板: 高青县| 石阡县| 拜城县| 罗山县| 海林市| 平昌县| 玛纳斯县| 开平市| 琼结县| 福海县| 新昌县| 广汉市| 平泉县| 长汀县| 鹿泉市| 北安市| 洪洞县| 廊坊市| 浪卡子县| 揭阳市| 南陵县| 镶黄旗| 澄城县| 中宁县| 鹤山市| 长春市| 波密县| 芜湖县| 芷江| 凭祥市| 怀柔区| 蓝山县| 伊通| 金坛市| 清苑县| 阿拉善右旗| 图们市| 平潭县| 大英县| 天等县| 呈贡县|