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