1.自己编辑相关的repo文件,Fedora.repo和fedora-updates.repo
改为不使用镜像列表,并添加镜像服务器,修改如下:
#fedora.repo文件
CODE:[fedora]
name=Fedora $releasever – $basearch
failovermethod=priority
#baseurl=http://download.fedora.RedHat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
baseurl=
http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirrors.usc.edu/pub/linux/distributions/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirrors.cat.pdx.edu/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://ftp.iij.ad.jp/pub/linux/fedora/releases/$releasever/Everything/$basearch/os/
ftp://ftp.iij.ad.jp/pub/linux/fedora/releases/$releasever/Everything/$basearch/os/
http://mirror.aarnet.edu.au/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirror.internode.on.net/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://gulus.usherbrooke.ca/pub/distro/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirror.karneval.cz/pub/linux/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://sunsite.mff.cuni.cz/MIRRORS/fedora.redhat.com/linux/releases/$releasever/Everything/$basearch/os/
http://ftp-stud.hs-esslingen.de/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://fedora.tu-chemnitz.de/pub/linux/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirror.fraunhofer.de/download.fedora.redhat.com/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://ftp.uni-bayreuth.de/linux/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://ftp.funet.fi/pub/mirrors/fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
ftp://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://limestone.uoregon.edu/ftp/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://fedora.mirror.iweb.ca/releases/$releasever/Everything/$basearch/os/
ftp://ftp.cse.buffalo.edu/pub/Linux/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirror.cc.vt.edu/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirrors.tummy.com/pub/fedora.redhat.com/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirrors.kernel.org/fedora/releases/$releasever/Everything/$basearch/os/
http://www.gtlib.gatech.edu/pub/fedora.redhat/linux/releases/$releasever/Everything/$basearch/os/
http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://ftp.iij.ad.jp/pub/linux/fedora/releases/$releasever/Everything/$basearch/os/
ftp://ftp.iij.ad.jp/pub/linux/fedora/releases/$releasever/Everything/$basearch/os/
http://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://ftp.rhnet.is/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirror.pacific.net.au/linux/fedora/linux/releases/$releasever/Everything/$basearch/os/
#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
#fedora-updates.repo文件
CODE:[updates]
name=Fedora $releasever – $basearch – Updates
failovermethod=priority
baseurl=
http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/
http://mirrors.usc.edu/pub/linux/distributions/fedora/linux/updates/$releasever/$basearch/
http://mirrors.cat.pdx.edu/fedora/linux/updates/$releasever/$basearch/
http://ftp.iij.ad.jp/pub/linux/fedora/updates/$releasever/$basearch/
ftp://ftp.iij.ad.jp/pub/linux/fedora/updates/$releasever/$basearch/
http://mirror.aarnet.edu.au/pub/fedora/linux/updates/$releasever/$basearch/
http://mirror.internode.on.net/pub/fedora/linux/updates/$releasever/$basearch/
http://gulus.usherbrooke.ca/pub/distro/fedora/linux/updates/$releasever/$basearch/
http://mirror.karneval.cz/pub/linux/fedora/linux/updates/$releasever/$basearch/
http://sunsite.mff.cuni.cz/MIRRORS/fedora.redhat.com/linux/updates/$releasever/$basearch/
http://ftp-stud.hs-esslingen.de/pub/fedora/linux/updates/$releasever/$basearch/
http://fedora.tu-chemnitz.de/pub/linux/fedora/linux/updates/$releasever/$basearch/
http://mirror.fraunhofer.de/download.fedora.redhat.com/fedora/linux/updates/$releasever/$basearch/
http://ftp.uni-bayreuth.de/linux/fedora/linux/updates/$releasever/$basearch/
http://ftp.funet.fi/pub/mirrors/fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/
ftp://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/updates/$releasever/$basearch/
http://limestone.uoregon.edu/ftp/fedora/linux/updates/$releasever/$basearch/
http://fedora.mirror.iweb.ca/updates/$releasever/$basearch/
ftp://ftp.cse.buffalo.edu/pub/Linux/fedora/linux/updates/$releasever/$basearch/
http://mirror.cc.vt.edu/pub/fedora/linux/updates/$releasever/$basearch/
http://mirrors.tummy.com/pub/fedora.redhat.com/fedora/linux/updates/$releasever/$basearch/
http://mirrors.kernel.org/fedora/updates/$releasever/$basearch/
http://www.gtlib.gatech.edu/pub/fedora.redhat/linux/updates/$releasever/$basearch/
http://ftp.linux.ncsu.edu/pub/fedora/linux/updates/$releasever/$basearch/
http://ftp.iij.ad.jp/pub/linux/fedora/updates/$releasever/$basearch/
ftp://ftp.iij.ad.jp/pub/linux/fedora/updates/$releasever/$basearch/
http://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora/linux/updates/$releasever/$basearch/
http://ftp.rhnet.is/pub/fedora/linux/updates/$releasever/$basearch/
http://mirror.pacific.net.au/linux/fedora/linux/updates/$releasever/$basearch/
#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
或下载我打包好的repo文件yum.repos.tar.gz[谁下载了此文件?],将原来的文件备份,然后覆盖
注意:这里的服务器可以自己定义,你可以只选择对自己来说最快的几个服务器即可
2.a.下载axel源码包并进行编译
到下面站点下载最新的axel源码包,http://wilmer.gaast.net/main.php/axel.html
.进入下载目录:
$tar zxvf 文件名
$cd 解压出来的目录
$./configure –i18n=1
$make
$make install
b.下载站点上有axel的rpm包提供,我没有试,有兴趣的帮忙试一下
3.我修改了服务器的地址,直接定位到rpm包所在的目录,因此无须进行判断,直接下载即可,如果使用的是镜像列表,则仍然需要进行i386和os的判断,具体请参见wq1977兄弟的帖子–关于yum太慢了的解决方案
我修改过的axelget,去掉了os,axelget.py文件代码:
CODE:from yum.plugins import PluginYumExit, TYPE_CORE, TYPE_INTERACTIVE
from urlparse import urljoin
import os
requires_api_version = ‘2.3’
plugin_type = (TYPE_CORE, TYPE_INTERACTIVE)
enablesize=300000
trymirrornum=-1
maxconn=10
def init_hook(conduit):
global enablesize,trymirrornum,maxconn
enablesize = conduit.confInt(‘main’,’enablesize’,default=30000)
trymirrornum = conduit.confInt(‘main’,’trymirrornum’,default=-1)
maxconn = conduit.confInt(‘main’,’maxconn’,default=10)
def predownload_hook(conduit):
global enablesize
preffermirror=””
for po in (conduit.getDownloadPackages()):
if hasattr(po, ‘pkgtype’) and po.pkgtype == ‘local’:
continue
totsize = long(po.size)
ret = False
if totsize <= enablesize:
conduit.info(2, “Package %s download size %d less than %d,Skip plugin!” % (po.repo.id,totsize,enablesize))
continue
else:
conduit.info(2, “Ok,we will try to use axel to download this big file:%d” % totsize)
local = po.localPkg()
if os.path.exists(local):
if not os.path.exists(local+”.st”):
fstate=os.stat(local)
if totsize == fstate.st_size:
conduit.info(2,”Target already exists,skip to next file!”)
continue
localall = “%s %s” % (local,local+”.st”)
rmcmd = “rm -f %s” % (localall)
curmirroridx = 0
conduit.info(2,”Before we start,clean all the key files”)
os.system(rmcmd)
connnum = totsize / enablesize
if connnum > maxconn:
connnum = maxconn
mirrors=[]
mirrors[:0]=po.repo.urls
if preffermirror != “”:
mirrors[:0] = [preffermirror]
for url in mirrors:
curmirroridx += 1
if (curmirroridx > trymirrornum) and (trymirrornum != -1):
conduit.info(2, “Package %s has tried %d mirrors,Skip plugin!” % (po.repo.id,trymirrornum))
break
remoteurl = urljoin(url, “%s” % po.remote_path)
syscmd = “axel -a -n %s %s -o %s” % (connnum,remoteurl,local)
conduit.info(2, “Execute axel cmd:\n%s” % syscmd)
os.system(syscmd)
if os.path.exists(local+”.st”):
conduit.info(2,”axel exit by exception,let’s try another mirror”)
continue
else:
ret = True
preffermirror=url
break
if not ret:
conduit.info (2,”try to run rm cmd:%s” % rmcmd)
os.system(rmcmd)
axelget.conf文件代码:
CODE:[main]
enabled=1
enablesize=10000
trymirrornum=3
新建这两个文件,将文件axelget.conf放入/etc/yum/pluginconf.d/目录,将axelget.py放入/usr/lib/yum-plugins/即可
然后:
sudo yum clean all
sudo yum update
4.注意事项:
1.如果出现错误找不到axel命令,编辑~/.bash_profile ,将PATH改为如下所示:
PATH=$PATH:$HOME/bin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
2.可在http://mirrors.Fedoraproject.org/publiclist/Fedora/$releasever/$basearch/查询可用的服务器,可能是因为Fedora 8 刚刚发布,所以有部分服务器还没有开放updates,如果提示没有这个目录,建议换个服务器或者是等待一段时间再试
3.baseurl的第一个服务器是绝对可以用的,是稳妥的设置,但速度上比较一般,50-100KB/s的样子可以根据自己实际情况更改为更快的服务器。
欢迎转载,请保留作者信息和链接地址,谢谢 !