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=//mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=//mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=//mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.ustc.edu.cn
baseurl=//mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=//mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=//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=//mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=//mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=//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=//mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=//mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=//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=//mirrors.ustc.edu.cn/centos/$releasever/contrib/$basearch/
#mirrorlist=//mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=//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