CentOS 6.2(32位)如何使用YUM源更新的方法

來源:互聯網
上載者:User

之前一直用RedHat el5 server做伺服器使用,但是Redhat的yum需要線上更新是需要收費的,所以後來換了CentOS 6.2版本,但是要想使用它的yum功能,還需要做一些其他的改動,以下是具體的內容:

1、 首先,由於公司需要使用代理才可以上外網,所以需要配置 一下yum的配置才可以和外界互連網串連,具體方法是:

        修改/etc/yum.conf檔案,在該檔案的後面加上Proxy 伺服器ip及連接埠,如果有使用者名稱和密碼的話,也要加上,沒有的話就不用了:

proxy=http://ip:portproxy_username=usernameproxy_password=password
2、 更改yum源,我們使用網易的CentOS鏡像源:
# cd /etc/yum.repos.d/# wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo# vi CentOS6-Base-163.repo

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

        如果第二步wget停用話,可以直接在瀏覽器中得到.repo設定檔。
        編輯檔案,把檔案裡面的$releasever全部替換為版本號碼,即6 最後儲存!或者直接把下面的記憶體拷貝到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.combaseurl=http://mirrors.163.com/centos/6/os/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=osgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#released updates[updates]name=CentOS-6 - Updates - 163.combaseurl=http://mirrors.163.com/centos/6/updates/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updatesgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-6 - Extras - 163.combaseurl=http://mirrors.163.com/centos/6/extras/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extrasgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages[centosplus]name=CentOS-6 - Plus - 163.combaseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplusgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-6 - Contrib - 163.combaseurl=http://mirrors.163.com/centos/6/contrib/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contribgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#########################################################################
3、 清理yum緩衝:

# yum clean all
# yum makecache     #將伺服器上的軟體包資訊緩衝到本地,以提高搜尋安裝軟體的速度
# yum install vim*    #測試網域名稱是否可用

        至此,Redhat6可以使用CentOS的yum源線上安裝軟體了!

4、 安裝外掛程式:

        最後,可以考慮裝個外掛程式,yum install yum-fastestmirror -y,這個會自動選擇快的那個源。

       

        如果我在那個目錄裡放了很多源,怎麼知道當前用的是那個呢?如果你沒有改yum.conf,那麼看/var/cache/yum/檔案夾裡的一個time開頭的檔案,就知道了。

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.