1.首先建立备选的源的URL,大家可以在https://wiki.ubuntu.com/Mirrors下找到所有ubuntu官方认可的源,把你认为可以选用的地区国家的源的URL拷贝到一个文件中,命名该文件为mirrors.txt
代码: 全选
http://archive.ubuntu.org.cn/ubuntu/
http://debian.cn99.com/ubuntu/
http://mirror.lupaworld.com/ubuntu/
http://mirrors.kernel.org/ubuntu/
http://mirror.cs.umn.edu/ubuntu/
http://lug.mtu.edu/ubuntu/
http://mirror.clarkson.edu/pub/distributions/ubuntu/
http://ubuntu.mirrors.tds.net/ubuntu/
http://www.opensourcemirrors.org/ubuntu/
http://ftp.ale.org/pub/mirrors/ubuntu/
http://ubuntu.secs.oakland.edu/
http://mirror.mcs.anl.gov/pub/ubuntu/
http://mirrors.cat.pdx.edu/ubuntu/
http://ubuntu.cs.utah.edu/ubuntu/
http://ftp.ussg.iu.edu/linux/ubuntu/
http://mirrors.xmission.com/ubuntu/
http://ftp.osuosl.org/pub/ubuntu/
http://mirrors.cs.wmich.edu/ubuntu/
http://mirrors.ccs.neu.edu/archive.ubuntu.com/
http://mirrors.easynews.com/linux/ubuntu/
http://cudlug.cudenver.edu/ubuntu/
http://mirrors.acm.jhu.edu/ubuntu/
http://ubuntu.cs.uaf.edu/ubuntu/
http://mirror.utdlug.org/linux/distributions/ubuntu/packages/
http://apt.ubuntu.org.tw/ubuntu/
http://apt.nc.hcc.edu.tw/pub/ubuntu/
http://ubuntu.csie.ntu.edu.tw/ubuntu/
http://ftp.cse.yzu.edu.tw/pub/Linux/Ubuntu/ubuntu/
http://mirror.nttu.edu.tw/ubuntu/
http://ubuntu.csie.nctu.edu.tw/ubuntu/
http://ubuntu.mithril-linux.org/archives/
2. 把下面的内容放到一个脚本文件中,比如叫searh.sh
代码: 全选
#!/bin/bash
mirrors=`cat mirrors.txt`
results="results.txt"
target="ls-lR.gz"
for mirror in $mirrors
do
echo "Testing $mirror ..."
curl -s $mirror$target -o $target \
-w 'Got speed: %{speed_download} from %{url_effective}\n' \
--connect-timeout 3 | tee -a $results
rm -f $target
done
代码: 全选
Testing http://mirrors.kernel.org/ubuntu/ ...
Got speed: 137334.000 from http://mirrors.kernel.org/ubuntu/ls-lR.gz
Testing http://mirror.cs.umn.edu/ubuntu/ ...
Got speed: 184164.000 from http://mirror.cs.umn.edu/ubuntu/ls-lR.gz
Testing http://lug.mtu.edu/ubuntu/ ...
Got speed: 212677.000 from http://lug.mtu.edu/ubuntu/ls-lR.gz
Testing http://mirror.clarkson.edu/pub/distributions/ubuntu/ ...
Got speed: 223.000 from http://mirror.clarkson.edu/pub/distributions/ubuntu/ls-lR.gz
Testing http://ubuntu.mirrors.tds.net/ubuntu/ ...
Got speed: 131305.000 from http://ubuntu.mirrors.tds.net/ubuntu/ls-lR.gz
Testing http://www.opensourcemirrors.org/ubuntu/ ...
Got speed: 416.000 from http://www.opensourcemirrors.org/ubuntu/ls-lR.gz
Testing http://ftp.ale.org/pub/mirrors/ubuntu/ ...
Got speed: 81387.000 from http://ftp.ale.org/pub/mirrors/ubuntu/ls-lR.gz
Testing http://ubuntu.secs.oakland.edu/ ...
Got speed: 129.000 from http://ubuntu.secs.oakland.edu/ls-lR.gz
Testing http://mirror.mcs.anl.gov/pub/ubuntu/ ...
Got speed: 54946.000 from http://mirror.mcs.anl.gov/pub/ubuntu/ls-lR.gz
Testing http://mirrors.cat.pdx.edu/ubuntu/ ...
Got speed: 166862.000 from http://mirrors.cat.pdx.edu/ubuntu/ls-lR.gz
Testing http://ubuntu.cs.utah.edu/ubuntu/ ...
Got speed: 94637.000 from http://ubuntu.cs.utah.edu/ubuntu/ls-lR.gz
Testing http://ftp.ussg.iu.edu/linux/ubuntu/ ...
Got speed: 178987.000 from http://ftp.ussg.iu.edu/linux/ubuntu/ls-lR.gz
Testing http://mirrors.xmission.com/ubuntu/ ...
Got speed: 177074.000 from http://mirrors.xmission.com/ubuntu/ls-lR.gz
Testing http://ftp.osuosl.org/pub/ubuntu/ ...
Got speed: 129962.000 from http://ftp.osuosl.org/pub/ubuntu/ls-lR.gz
Testing http://mirrors.cs.wmich.edu/ubuntu/ ...
Got speed: 0.000 from http://mirrors.cs.wmich.edu/ubuntu/ls-lR.gz
Testing http://mirrors.ccs.neu.edu/archive.ubuntu.com/ ...
Got speed: 0.000 from http://mirrors.ccs.neu.edu/archive.ubuntu.com/ls-lR.gz
Testing http://mirrors.easynews.com/linux/ubuntu/ ...
Got speed: 50268.000 from http://mirrors.easynews.com/linux/ubuntu/ls-lR.gz
Testing http://cudlug.cudenver.edu/ubuntu/ ...
Got speed: 9466.000 from http://cudlug.cudenver.edu/ubuntu/ls-lR.gz
Testing http://mirrors.acm.jhu.edu/ubuntu/ ...
Got speed: 0.000 from http://mirrors.acm.jhu.edu/ubuntu/ls-lR.gz
Testing http://ubuntu.cs.uaf.edu/ubuntu/ ...
Got speed: 132275.000 from http://ubuntu.cs.uaf.edu/ubuntu/ls-lR.gz
Testing http://mirror.utdlug.org/linux/distributions/ubuntu/packages/ ...
Got speed: 84594.000 from http://mirror.utdlug.org/linux/distributions/ubuntu/packages/ls-lR.gz
Testing http://apt.ubuntu.org.tw/ubuntu/ ...
Got speed: 0.000 from http://apt.ubuntu.org.tw/ubuntu/ls-lR.gz
Testing http://apt.nc.hcc.edu.tw/pub/ubuntu/ ...
Got speed: 0.000 from http://apt.nc.hcc.edu.tw/pub/ubuntu/ls-lR.gz
Testing http://ubuntu.csie.ntu.edu.tw/ubuntu/ ...
Got speed: 227607.000 from http://ubuntu.csie.ntu.edu.tw/ubuntu/ls-lR.gz
Testing http://ftp.cse.yzu.edu.tw/pub/Linux/Ubuntu/ubuntu/ ...
Got speed: 0.000 from http://ftp.cse.yzu.edu.tw/pub/Linux/Ubuntu/ubuntu/ls-lR.gz
Testing http://mirror.nttu.edu.tw/ubuntu/ ...
Got speed: 8.000 from http://mirror.nttu.edu.tw/ubuntu/ls-lR.gz
原文出处:
http://blog.acmelab.org/2006/07/10/quic ... r-chooser/