修改yum源为国内源

| |
[阴 2010/04/07 18:04 | by birdsky ]
yum虽然很好用,但却有一个小问题,那就是更新速度。对于国内用户,尤其是你的网速还不够快的时候,使用yum意味着漫长的等待。我搜集了几个速度不错的国内源,大家可以自己选择、测试、修改。需要修改的文件是/etc/yum.repos.d/CentOS-Base.repo,记得备份!

首先,备份原yum源
cd /etc/yum.repos.d/
cp CentOS-Base.repo CentOS-Base.repo.bak

然后在下面的源中选择一个来用
vi CentOS-Base.repo
最后更新缓存
yum makecache

以下为收集到的源
1.默认的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/  
gpgcheck=1  
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5  
priority=1  
 
#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/  
gpgcheck=1  
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5  
priority=1  
 
#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/  
gpgcheck=1  
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5  
priority=1  
 
#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/  
gpgcheck=1  
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5  
priority=1  
 
#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/  
gpgcheck=1  
enabled=0  
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5  
priority=2  

2.USTC源
该源由中国科学技术大学提供,合肥电信,每小时更新,CentOS官方镜像。编辑CentOS-Base.repo内容如下,下同。

USTC
[base]  
name=CentOS-$releasever - Base  
baseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/  
gpgcheck=1  
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5  
 
[updates]  
name=CentOS-$releasever - Updates  
baseurl=http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/  
gpgcheck=1  
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5  
 
[addons]  
name=CentOS-$releasever - Addons  
baseurl=http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/  
gpgcheck=1  
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5  
 
[extras]  
name=CentOS-$releasever - Extras  
baseurl=http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/  
gpgcheck=1  
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5  
 
[centosplus]  
name=CentOS-$releasever - Plus  
baseurl=http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/  
gpgcheck=1  
enabled=0  
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5  

3.mirror.centos.net.cn源
该源同样为CentOS官方镜像,属于北京网通,北方网通用户推荐。

mirror.centos.net.cn
[base]  
name=CentOS-$releasever - Base  
baseurl=http://mirror.centos.net.cn/$releasever/os/$basearch/  
gpgcheck=1  
gpgkey=http://mirror.centos.net.cn/RPM-GPG-KEY-CentOS-5  
 
[update]  
name=CentOS-$releasever - Updates  
baseurl=http://mirror.centos.net.cn/$releasever/updates/$basearch/  
gpgcheck=1  
gpgkey=http://mirror.centos.net.cn/RPM-GPG-KEY-CentOS-5  
 
[addons]  
name=CentOS-$releasever - Addons  
baseurl=http://mirror.centos.net.cn/$releasever/addons/$basearch/  
gpgcheck=1  
gpgkey=http://mirror.centos.net.cn/RPM-GPG-KEY-CentOS-5  
 
[extras]  
name=CentOS-$releasever - Extras  
baseurl=http://mirror.centos.net.cn/$releasever/extras/$basearch/  
gpgcheck=1  
gpgkey=http://mirror.centos.net.cn/RPM-GPG-KEY-CentOS-5  
 
[centosplus]  
name=CentOS-$releasever - Plus  
baseurl=http://mirror.centos.net.cn/$releasever/centosplus/$basearch/  
gpgcheck=1  
enabled=1  
gpgkey=http://mirror.centos.net.cn/RPM-GPG-KEY-CentOS-5  
 
[contrib]  
name=CentOS-$releasever - Contrib  
baseurl=http://mirror.centos.net.cn/$releasever/contrib/$basearch/  
gpgcheck=1  
enabled=0  
gpgkey=http://mirror.centos.net.cn/RPM-GPG-KEY-CentOS-5  

4.网易源
http://mirrors.163.com, 该源由网易提供,杭州电信。下载CentOS-Base-163.repo, 放入/etc/yum.repos.d/,然后运行yum makecache生成缓存。

NETEASE:mirrors.163.com
[base]  
name=CentOS-$releasever - Base  
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/  
gpgcheck=1  
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5  
 
[update]  
name=CentOS-$releasever - Updates  
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/  
gpgcheck=1  
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5  
 
[addons]  
name=CentOS-$releasever - Addons  
baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/  
gpgcheck=1  
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5  
 
[extras]  
name=CentOS-$releasever - Extras  
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/  
gpgcheck=1  
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5  
 
[centosplus]  
name=CentOS-$releasever - Plus  
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/  
gpgcheck=1  
enabled=1  
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5  
 
[contrib]  
name=CentOS-$releasever - Contrib  
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/  
gpgcheck=1  
enabled=0  
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5  

5.搜狐源
http://mirrors.sohu.com ,该源由搜狐提供,山东联通。下载CentOS-Base-sohu.repo, 放入/etc/yum.repos.d/,然后运行yum makecache生成缓存。

SOHU:mirrors.sohu.com
[base]  
name=CentOS-$releasever - Base  
baseurl=http://mirrors.sohu.com/centos/$releasever/os/$basearch/  
gpgcheck=1  
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5  
 
[update]  
name=CentOS-$releasever - Updates  
baseurl=http://mirrors.sohu.com/centos/$releasever/updates/$basearch/  
gpgcheck=1  
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5  
 
[addons]  
name=CentOS-$releasever - Addons  
baseurl=http://mirrors.sohu.com/centos/$releasever/addons/$basearch/  
gpgcheck=1  
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5  
 
[extras]  
name=CentOS-$releasever - Extras  
baseurl=http://mirrors.sohu.com/centos/$releasever/extras/$basearch/  
gpgcheck=1  
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5  
 
[centosplus]  
name=CentOS-$releasever - Plus  
baseurl=http://mirrors.sohu.com/centos/$releasever/centosplus/$basearch/  
gpgcheck=1  
enabled=1  
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5  
 
[contrib]  
name=CentOS-$releasever - Contrib  
baseurl=http://mirrors.sohu.com/centos/$releasever/contrib/$basearch/  
gpgcheck=1  
enabled=0  
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5  
Tags: ,
linux小记 | 评论(0) | 引用(0) | 阅读(58667)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 请输入左侧的字母,不区分大小写