学盟网是一个互助、分享,一起学习和成长的公益平台,学盟网,有你更精彩!按Ctrl+D收藏学盟网!
当前位置:首页 > 电脑 > linux → Linux CentOS 6怎么换更新源

Linux CentOS 6怎么换更新源

时间:2016-11-30 16:22:47 作者:andy 来源:linux 阅读:

平时在安装或更新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怎么换更新源”的人还看了:

123

文章目录

CopyRight © 2011-2016 学盟网 www.xuenb.com All Rights Reserved.

'); })();