您的位置:首页 > 运维架构 > Linux

解决在CentOS 5.5 yum源下载慢的办法即修改yum源

2011-11-30 18:50 585 查看
最近在虚拟机下面安装了个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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: