Linux CentOS6怎么換更新源
平時(shí)在安裝或更新CentOS軟件時(shí),yum方式是最簡(jiǎn)單方便的,而系統(tǒng)默認(rèn)到y(tǒng)um更新源地址不穩(wěn)定,所以需要對(duì)更新源地址進(jìn)行修改,那么Linux CentOS 6怎么換更新源呢?今天學(xué)習(xí)啦小編與大家分享下Linux CentOS 6換更新源的具體操作步驟,有需要的朋友不妨了解下。
Linux CentOS 6換更新源方法
1.進(jìn)入root。
2.備份CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
3.創(chuàng)建一個(gè)新的CentOS-Base.repo。
vim CentOS-Base.repo
4.直接復(fù)制,或輸入下列進(jìn)去(注意:復(fù)制的話前面的‘#’號(hào)要注意是否有漏掉。)
# 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
出現(xiàn)是否覆蓋,按 y 回車。
7.生成緩存。
yum makecache
8.刪除自己創(chuàng)建的CentOS-Base.repo。
rm CentOS-Base.repo
看過“Linux CentOS 6怎么換更新源”的人還看了: