感谢支持
我们一直在努力

修改yum使用163开源镜像升级CentOS

yum使用http://mirror.centos.org/的镜像升级和下载软件有点小慢,现在网易干了件好事就是有了http://mirrors.163.com/这个开源镜像站,速度还不是一般的快。


根据网上的文章“使用163开源镜像升级你的CentOS”修改,很简单的,操作过程如下,做个笔记。平时用的是CentOS 4.7 sever版,网上多是CentOS 5.X版的,只是改动了gpgkey的验证版本和网站,因为baseurl的链接都是163的。当然不修改也可以,但是163镜像如果没有及时和CentOS镜像同步,估计使用yum时会有问题只是估计。


1.备份系统原来的CentOS-Base.repo文件:
cd /etc/yum.repos.d/
#cp -a CentOS-Base.repo CentOS-Base.repo.bak


2.用vi打开CentOS-Base.repo文件:
#vim CentOS-Base.repo


修改后的CentOS-Base.repo文件,代码如下:


# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# 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
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5


gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-4


#released updates
[updates]
name=CentOS-$releasever – Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5


gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-4


#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever – Addons
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
gpgcheck=1
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5


gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-4


#additional packages that may be useful
[extras]
name=CentOS-$releasever – Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5


gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-4


#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever – Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5


gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-4

赞(0) 打赏
转载请注明出处:服务器评测 » 修改yum使用163开源镜像升级CentOS
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏