2014-02-07
方法一:手動修改/etc/yum.repos.d/CentOS-Base.repo,增加黃色那幾行
[root@localhost yum.repos.d]# vi CentOS-Base.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] baseurl=http://ftp.isu.edu.tw/pub/Linux/CentOS/$releasever/os/$basearch/ name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #released updates [updates] baseurl=http://ftp.isu.edu.tw/pub/Linux/CentOS/$releasever/updates/$basearch/ name=CentOS-$releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] baseurl=http://ftp.isu.edu.tw/pub/Linux/CentOS/$releasever/extras/$basearch/ name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] baseurl=http://ftp.isu.edu.tw/pub/Linux/CentOS/$releasever/centosplus/$basearch/ name=CentOS-$releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] baseurl=http://ftp.isu.edu.tw/pub/Linux/CentOS/$releasever/contrib/$basearch/ name=CentOS-$releasever - Contrib mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 [root@localhost yum.repos.d]# |
*********************************************************************************
方法二:利用 Shell Script 快速變更
#!/bin/bash #------------ # change.sh #------------ cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.old sed -i -e "/\[base\]/abaseurl=http:\/\/ftp.isu.edu.tw\/pub\/Linux\/CentOS\/\$releasever\/os\/\$basearch\/" /etc/yum.repos.d/CentOS-Base.repo sed -i -e "/\[updates\]/abaseurl=http:\/\/ftp.isu.edu.tw\/pub\/Linux\/CentOS\/\$releasever\/updates\/\$basearch\/" /etc/yum.repos.d/CentOS-Base.repo sed -i -e "/\[extras\]/abaseurl=http:\/\/ftp.isu.edu.tw\/pub\/Linux\/CentOS\/\$releasever\/extras\/\$basearch\/" /etc/yum.repos.d/CentOS-Base.repo sed -i -e "/\[centosplus\]/abaseurl=http:\/\/ftp.isu.edu.tw\/pub\/Linux\/CentOS\/\$releasever\/centosplus\/\$basearch\/" /etc/yum.repos.d/CentOS-Base.repo sed -i -e "/\[contrib\]/abaseurl=http:\/\/ftp.isu.edu.tw\/pub\/Linux\/CentOS\/\$releasever\/contrib\/\$basearch\/" /etc/yum.repos.d/CentOS-Base.repo sed -i -e "/\[addons\]/abaseurl=http:\/\/ftp.isu.edu.tw\/pub\/Linux\/CentOS\/\$releasever\/addons\/\$basearch\/" /etc/yum.repos.d/CentOS-Base.repo cat /etc/yum.repos.d/CentOS-Base.repo | grep "baseurl" |
(完)
相關文章
[研究] 架設 CentOS 6.0 Yum Server
http://shaurong.blogspot.com/2011/07/centos-60-yum-server_17.html
http://forum.icst.org.tw/phpbb/viewtopic.php?f=16&t=80721
[研究] 架設 Fedora 15 Yum Server
http://forum.icst.org.tw/phpbb/viewtopic.php?t=20258
[研究] CentOS 6.0 yum server 指定義守大學方法
http://shaurong.blogspot.com/2011/07/centos-60-yum-server.html
http://forum.icst.org.tw/phpbb/viewtopic.php?f=16&t=20206
[研究] CentOS 5.5 yum server 指定義守大學方法
http://forum.icst.org.tw/phpbb/viewtopic.php?f=16&t=19592
[研究] Fedora 15 x86 yum server 指定義守大學方法
http://shaurong.blogspot.com/2011/07/fedora-15-x86-yum-server.html
[研究] Fedora 14 yum server 指定義守大學方法
http://forum.icst.org.tw/phpbb/viewtopic.php?f=16&t=19591
沒有留言:
張貼留言