解决在CentOS  yum源下载慢的办法


最近在虚拟机下面安装了个CentOS 5.5,使用yum更新时发现下载速度异常慢。可以修改yum的配置文件,把其镜像指向国内的服务器即可。
方案一:
# cd /etc/yum.repos.d/
# mv CentOS-Base.repo CentOS-Base.repo.bak
# wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
方案二:
手段修改CentOS-Base.repo文件,将baseurl设置成baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/
详细配置如下:


[base]


name=CentOS-5-Base


#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&repo=os


#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/


baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/


gpgcheck=1


gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5


#released updates


[update]


name=CentOS-5-Updates


#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates


baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/


gpgcheck=1


gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5


#packages used/produced in the build but not released


[addons]


name=CentOS-5-Addons


#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons


baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/


gpgcheck=1


gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5


#additional packages that may be useful


[extras]


name=CentOS-5-Extras


#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras


baseurl=http://ftp.sjtu.edu.cn/centos/5/extras/$basearch/


gpgcheck=1


gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5


#additional packages that extend functionality of existing packages


[centosplus]


name=CentOS-5-Plus


#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus


baseurl=http://ftp.sjtu.edu.cn/centos/5/centosplus/$basearch/


gpgcheck=1


enabled=0


gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5


#contrib – packages by Centos Users


[contrib]


name=CentOS-5-Contrib


#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib


baseurl=http://ftp.sjtu.edu.cn/centos/5/contrib/$basearch/


gpgcheck=1


enabled=0


gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5


导入 key
# rpm –import http://ftp.sjtu.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
运行,测试
# yum update  
全部删除临时文件

#yum clean all


原文地址:http://www.cnblogs.com/codebean/archive/2011/05/27/2059900.html

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐