How to: Find the fastest apt mirror server for Debian or Ubuntu
如何找到Debian或Ubuntu 里最快的apt镜像服务器
Submitted by ggarron on Wed, 05/14/2008 – 16:51
If you want to use the fastest mirror to download the .deb files you may need to upgrade or update your Debian machines, you have to remember that not always your nearest server is the fastest one, and that could be because not only the distance the server is from you but also the network congestion is a factor when talking about network speed.
当你想从最快的镜像下载.deb文件来升级或更新你Debian系统的时候,你必须明白,离你最近的服务器不一定是最快的,因为网速不仅取决于你跟服务器之间的距离,还取决于网络拥塞情况。
For instance, your ISP may have a direct satellite connection to another country, and thus your nearest server should be in that country, to avoid you the hassle to get that info, Debian give you some tools, I will touch two of them here.
譬如,你的ISP(互联网提供商)可能拥有一个专有卫星链接到他国,那样,距你最近的服务器很可能就是在他国。为了解决你在获取这些信息时可能遭遇的麻烦,Debian提供了一些工具,这里先介绍其中的两个。
1.0 Netselect-apt
This tool will download the full list of mirrors and will quickly explore throw them for the fastest mirror for you, the use of it really easy and reliable.
这个会把全部镜像的列表下载下来,并从中迅速的找出最快的镜像,操作非常简单可靠。
Installation
You just need to run:
安装,在终端下输入:
sudo aptitude install netselect-apt
Running it
Once installed, run
运行命令,命令运行完毕后,继续输入:
sudo netselect-apt -n -s lenny
Be sure to change lenny for your appropriate version, you can use the name of the version, (edge, lenny, sid) or the words stable, testing, unstable, experimental.
把lenny修改成你所在的版本,你可以用版本的名称替换,(譬如 lenny,sid)或者用版本注明文字: stable(稳定版), testing(测试版), unstable(不稳定版), experimental(试验版).
It will then write a sources.list file in the current directory, you may then copy that file to /etc/apt/sources.list or just edit and copy the lines you need from one to the other.
它将在当前文件夹创建一个sources.list文件,你可以复制需要的部分到/etc/apt/sources.list,也可以用这个文件取代原文件。
If you see, I have used -n and -s options, because I wanted to get the non-free section, and deb-src to be able to use apt-get source
如你所见,我使用了-n和-s参数,因为,我想用apt-get下载非开源软件和deb-src(源代码文件)
2.0 apt-spy
apt-spy is a little bit more flexible, well maybe flexible is not the right word, as in netselect-apt you can also select some specific mirrors to explore, you have to edit the mirrors_full file, while with apt-spy you just enter the countries you may want to explore for servers.
apt-spy要比 netselect-apt灵活一点,或许,灵活并不能准确描述这种差异。当你想测试特定的镜像服务器时,netselect-apt要求你在mirrors_full文件里输入特定服务器的完整名字,apt-spy则只要你键入国家的名称即可。
Installation
To install it run:
安装,在终端下输入:
sudo aptitude install apt-spy
Running it
运行命令
You first need to get the mirrors file, and contrary to netselect-apt apt-spy does not do that automatically, so first run:
你必须先下载镜像文件,因为apt-spy并不会像netselcet-apt一样自动下载,所以,先输入:
sudo apt-spy update
Now it is time to run the tool:
好了,现在可以使用apt-spy命令了:
sudo apt-spy -a North-America -a Europe
To check for available servers in Noerth-America and Europe, if you want to create your own zone, just edit the file /etc/apt-spy.conf and add something like this:
这是在测定北美和欧洲可用的服务器,如果你想创建你自己的地区,只需在/etc/apt-apy.conf文件里像这样添加地区名称:
France-Germany-Netherlands:
FR
DE
NL
法国-德国-荷兰
The sources.list will be then copied to /etc/apt/sources.list.d/apt-spy.list
这个sources.list将会被复制到/etc/apt/sources.list.d/apt-spy.list
As you see, it is really easy to manage, it takes a little bit longer than netselect-apt to run, but also works well.
虽然apt-spy要比netselect-apt运行的时间长一点,但它并不难掌握和运行
。
Note: Remember that during the week, or even the day not the same server is the fastest one for you, as conditions in the Internet change all the time.
PS:记住,互联网时刻在变化,这周,或者说今天测试出来最快的镜像服务器并不一定在未来也是最快的。
How to: Find the fastest apt mirror server for Debian or Ubuntu(如何为ubuntu或debian找到最快的apt镜像站点)
最新推荐文章于 2023-05-07 00:15:00 发布