我优化yum的知识,主要来源于以下2篇链接文章:
感谢wq1977、感谢亚森罗平、以及所有帖子里、帖子外出现的朋友。
我这篇的东西只是整理粘贴一下。要深入理解的同学,请详细看上面链接文章。
小提示:
1、axel是wq1977大侠开发的,国货哦。
2、另有shawn.p.huang大侠开发了一款中文输入法,目前在快速完善升级中,现已率先加入Fedora官方源,详情看这里
。
3、Fedora 9 将通过yum-presto插件实现差量下载,也就是说只下载旧包与新包的差异部分。效率几乎提升10倍。
以Fedora 8 、axel 1.0b 为例,以root权限操作,开始。
================================================
一、安装yum-fastestmirror
引用
yum install yum-fastestmirror
二、安装axel
注:我个人遇到的bug是假如yum(安装axel并启用后)要下载10个文件,第6个就中止了,那么再运行yum命令时,需要10个都重新下载。但这时我会在axelget.conf中把enabled值修改,临时禁用axel,免得重复下载已完成的部分。
1、获得axelget.conf
引用
cd /etc/yum/pluginconf.d/
wget
wget
2、获得axelget.py
引用
cd /usr/lib/yum-plugins/
wget
wget
3、获得axel源码和安装。
引用
cd /usr/local/src
wget
tar zxvf axel-1.0b.tar.gz
cd axel-1.0b
./configure --i18n=1
make
make install
wget
tar zxvf axel-1.0b.tar.gz
cd axel-1.0b
./configure --i18n=1
make
make install
三、优化fedora.repo与fedora-updates.repo文件
官方的镜像列表$releasever/$basearch/
优化前请做好备份。
引用
tar jcvf MyReposBak.tar.bz2 /etc/yum.repo.d/
chmod 444 MyReposBak.tar.bz2
chmod 444 MyReposBak.tar.bz2
亚森罗平兄的fedora.repo文件的头一段:
程序代码:
[fedora]
name=Fedora $releasever - $basearch
failovermethod=priority
#baseurl=
baseurl=
ftp://ftp.iij.ad.jp/pub/linux/fedora/releases/$releasever/Everything/$basearch/os/
http://sunsite.mff.cuni.cz/MIRRORS/fedora.redhat.com/linux/releases/$releasever/Everything/$basearch/os/
ftp://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/releases/$releasever/Everything/$basearch/os/
ftp://ftp.cse.buffalo.edu/pub/Linux/fedora/linux/releases/$releasever/Everything/$basearch/os/
ftp://ftp.iij.ad.jp/pub/linux/fedora/releases/$releasever/Everything/$basearch/os/
#mirrorlist=
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
name=Fedora $releasever - $basearch
failovermethod=priority
#baseurl=
baseurl=
ftp://ftp.iij.ad.jp/pub/linux/fedora/releases/$releasever/Everything/$basearch/os/
http://sunsite.mff.cuni.cz/MIRRORS/fedora.redhat.com/linux/releases/$releasever/Everything/$basearch/os/
ftp://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/releases/$releasever/Everything/$basearch/os/
ftp://ftp.cse.buffalo.edu/pub/Linux/fedora/linux/releases/$releasever/Everything/$basearch/os/
ftp://ftp.iij.ad.jp/pub/linux/fedora/releases/$releasever/Everything/$basearch/os/
#mirrorlist=
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文件的头一段
程序代码:
[updates]
name=Fedora $releasever - $basearch - Updates
failovermethod=priority
baseurl=
ftp://ftp.iij.ad.jp/pub/linux/fedora/updates/$releasever/$basearch/
http://sunsite.mff.cuni.cz/MIRRORS/fedora.redhat.com/linux/updates/$releasever/$basearch/
ftp://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/updates/$releasever/$basearch/
ftp://ftp.cse.buffalo.edu/pub/Linux/fedora/linux/updates/$releasever/$basearch/
ftp://ftp.iij.ad.jp/pub/linux/fedora/updates/$releasever/$basearch/
#mirrorlist=
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
name=Fedora $releasever - $basearch - Updates
failovermethod=priority
baseurl=
ftp://ftp.iij.ad.jp/pub/linux/fedora/updates/$releasever/$basearch/
http://sunsite.mff.cuni.cz/MIRRORS/fedora.redhat.com/linux/updates/$releasever/$basearch/
ftp://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/updates/$releasever/$basearch/
ftp://ftp.cse.buffalo.edu/pub/Linux/fedora/linux/updates/$releasever/$basearch/
ftp://ftp.iij.ad.jp/pub/linux/fedora/updates/$releasever/$basearch/
#mirrorlist=
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
优化的方法是一个个域名ping,把最快的镜像放在上面。我优化后的(公网ADSL2M)平时可达80~130KB/s,快的时候可以达峰值180~210KB/s。根据使用经验,澳大利亚的源最稳定,但负担重,同步较慢;台湾省opensource.nchc.org.tw的源是ping不通的,但firefox打开速度却最快。一般以下3个源比较快,如果想临时禁用某个源可以在repo文件中前面加“#”:
引用
mirror.pacific.net.au
opensource.nchc.org.tw
ftp.iij.ad.jp
opensource.nchc.org.tw
ftp.iij.ad.jp
我的fedora.repo文件
程序代码:
[fedora]
name=Fedora $releasever - $basearch
failovermethod=priority
baseurl=
#mirrorlist=
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
[fedora-debuginfo]
name=Fedora $releasever - $basearch - Debug
failovermethod=priority
baseurl=
#mirrorlist=
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
[fedora-source]
name=Fedora $releasever - Source
failovermethod=priority
baseurl=
#mirrorlist=
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
name=Fedora $releasever - $basearch
failovermethod=priority
baseurl=
#mirrorlist=
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
[fedora-debuginfo]
name=Fedora $releasever - $basearch - Debug
failovermethod=priority
baseurl=
#mirrorlist=
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
[fedora-source]
name=Fedora $releasever - Source
failovermethod=priority
baseurl=
#mirrorlist=
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
我的fedora-updates.repo文件
程序代码:
[updates]
name=Fedora $releasever - $basearch - Updates
failovermethod=priority
baseurl=
#mirrorlist=
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
[updates-debuginfo]
name=Fedora $releasever - $basearch - Updates - Debug
failovermethod=priority
baseurl=
debug/
debug/
debug/
debug/
debug/
#mirrorlist=
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
[updates-source]
name=Fedora $releasever - Updates Source
failovermethod=priority
baseurl=
#mirrorlist=
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
name=Fedora $releasever - $basearch - Updates
failovermethod=priority
baseurl=
#mirrorlist=
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
[updates-debuginfo]
name=Fedora $releasever - $basearch - Updates - Debug
failovermethod=priority
baseurl=
debug/
debug/
debug/
debug/
debug/
#mirrorlist=
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
[updates-source]
name=Fedora $releasever - Updates Source
failovermethod=priority
baseurl=
#mirrorlist=
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora