歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

Linux CentOS 6怎麼換更新源

  平時在安裝或更新CentOS軟件時,yum方式是最簡單方便的,而系統默認到yum更新源地址不穩定,所以需要對更新源地址進行修改,那麼Linux CentOS 6怎麼換更新源呢?今天學習啦小編與大家分享下Linux CentOS 6換更新源的具體操作步驟,有需要的朋友不妨了解下。

  Linux CentOS 6換更新源方法

  1.進入root。

  2.備份CentOS-Base.repo

  mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

  3.創建一個新的CentOS-Base.repo。

  vim CentOS-Base.repo

  4.直接復制,或輸入下列進去(注意:復制的話前面的‘#’號要注意是否有漏掉。)

  # 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-$releasever - Base - mirrors.ustc.edu.cn

  baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/

  #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

  gpgcheck=1

  gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

  #released updates

  [updates]

  name=CentOS-$releasever - Updates - mirrors.ustc.edu.cn

  baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/

  #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

  gpgcheck=1

  gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

  #additional packages that may be useful

  [extras]

  name=CentOS-$releasever - Extras - mirrors.ustc.edu.cn

  baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/

  #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

  gpgcheck=1

  gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

  #additional packages that extend functionality of existing packages

  [centosplus]

  name=CentOS-$releasever - Plus - mirrors.ustc.edu.cn

  baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/

  #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

  gpgcheck=1

  enabled=0

  gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

  #contrib - packages by Centos Users

  [contrib]

  name=CentOS-$releasever - Contrib - mirrors.ustc.edu.cn

  baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/contrib/$basearch/

  #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib

  gpgcheck=1

  enabled=0

  gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

  5.保存:按'Shift'+';',再按'x',回車。

  6.替換CentOS-Base.repo。

  cp -f CentOS-Base.repo /etc/yum.repos.d

  出現是否覆蓋,按 y 回車。

  7.生成緩存。

  yum makecache

  8.刪除自己創建的CentOS-Base.repo。

  rm CentOS-Base.repo

 

看過“Linux CentOS 6怎麼換更新源”的人還看了:

Copyright © Linux教程網 All Rights Reserved