`

linux yum - yum fastermirror安装配置使用

阅读更多
【基本介绍】
yum  is  an  interactive,  rpm  based, package manager.(yum是一个包的管理器)
yum可以简化系统软件更新的工作。为了保证更新的持续进行,通常都会提供多个mirror(镜像)地址供下载使用,但由于存在地域问题,从不同的镜像下载速度差异很大。选择从适合的镜像下载软件包,会极大的影响更新速度。以CentOS为例,可使用一个叫fastestmirror的插件,让yum在更新时先根据ping值进行判断,然后从最快响应的地址下载。
这里介绍fastermirror.

【安装配置】
从CentOS5.0开始fastermirror就默认安装了,我们这里主要介绍配置
1.安装
yum install yum-plugin-fastestmirror

2.验证
[root@pandaVM script]# 
[root@pandaVM script]# yum search yum-plugin-fastestmirror
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile

3.配置
fastestmirror里面的enable=1
[root@pandaVM script]# cat /etc/yum/pluginconf.d/fastestmirror.conf 
[main]
enabled=1
verbose=0
always_print_best_host = true
socket_timeout=3
#  Relative paths are relative to the cachedir (and so works for users as well
# as root).
hostfilepath=timedhosts.txt
maxhostfileage=10
maxthreads=15
#exclude=.gov, facebook
#include_only=.nl,.de,.uk,.ie

yum.conf里面的plugins=1
[root@pandaVM script]# cat /etc/yum.conf 
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d


[root@localhost ~]# cat /var/cache/yum/timedhosts.txt
mirrors.cug.edu.cn 0.0390000343323
mirror.bit.edu.cn 0.417052030563
mirrors.hustunique.com 0.0460698604584
mirrors.hust.edu.cn 0.189108133316
mirrors.yun-idc.com 0.0331869125366
mirrors.btte.net 0.0333859920502
mirrors.skyshe.cn 0.0205020904541
mirrors.163.com 0.0148000717163
mirrors.aliyun.com 0.0303590297699
mirror.neu.edu.cn 0.0602879524231
www7.atomicorp.com 0.618637084961
mirror.bit.edu.cn 0.525043010712
centos.ustc.edu.cn 0.317930936813
mirrors.163.com 0.0135080814362
mirrors.tuna.tsinghua.edu.cn 0.193212032318
www2.atomicorp.com 0.415390014648
mirrors.skyshe.com 0.329003095627
atomic.mirror.uber.com.au 1.13594508171
www3.atomicorp.com 0.425523996353
www6.atomicorp.com 0.45193195343
mirrors.stuhome.net 0.592149019241
mirrors.btte.net 0.164302110672
mirrors.neusoft.edu.cn 0.478916883469
mirrors.grandcloud.cn 0.243366956711
www5.atomicorp.com 0.452031850815
mirrors.hustunique.com 0.24665594101
mirrors.yun-idc.com 0.147311925888
www4.atomicorp.com 99999999999
mirror.neu.edu.cn 0.158205032349


【问题】
遇到一个yum在执行的时候一直卡在寻找最佳mirror地方,我们可以在mirrorlist里面找几个地址ping一下,发现都不通。其实是域名解析有问题。

【参考】
http://bbs.51cto.com/thread-549433-1.html
http://blog.sina.com.cn/s/blog_7e513d7e01015j9b.html
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics