现在用新软件越来越少,所以都是做个定时任务,让我的Debian系统半夜去下载升级包;然后等那天有空的时候,自己来操作升级软件:节省了升级时候的等待时间了。不过最近两天unstable里面狂升Xorg,一堆东西都乱七八糟的,不得不多关注一下了。
话说自从换了工作地点,原来一直用的台湾和日本的Debian镜像服务器的速度立马大不如前。不过反正都是系统去下载东东,我也用不着等待,也就懒得管它了。今天正好有点时间,重新调整了一下sources.list,惊奇的发现现在官方镜像服务器列表里,我连接debian.ihug.com.au的速度最快,这是什么原理?
做一下工作记录:
1、先检索了一下检测Debian服务器速度的软件包:
apt-cache search apt source
发现有apt-spy和netselect-apt两个软件都可用。以前用过apt-spy,这次就试试netselect-apt了:
sudo apt-get install netselect-apt
2、简单看一下帮助,学习一下:
netselect-apt --help
启动程序,让它帮我生成unstable的sources.list:
2$ sudo netselect-apt unstable
Password:
Using distribution unstable.
Retrieving the list of mirrors from www.debian.org...
--15:01:37-- http://www.debian.org/mirror/mirrors_full
=> `mirrors_full'
正在解析主机 www.debian.org... 194.109.137.218
Connecting to www.debian.org|194.109.137.218|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:174,758 (171K) [text/html]
27% [==================> ] 47,322 29.06K/s
15:01:41 (29.03 KB/s) - Read error at byte 47322/174758 (Connection reset by peer). 重试中。
发现程序开始反复被从服务器上断开连接。嗯,惊诧了几秒钟,想到可能是GFW作怪,于是打开浏览器,通过代理手工把Debian代理服务器列表拖到硬盘上(嗯,果然,应该是那个最能引起GFW警报的关键词FREENET作怪),放在netselect-apt执行时的目录中。
3、再启动:
0$ sudo netselect-apt unstable
Using distribution unstable.
There is a already a mirrors_full file in the current
directory. I'll use that, rather than downloading it again.
Choosing a main Debian mirror using netselect.
Running netselect to choose 1 out of 77 addresses.
.......................................
The fastest server seems to be:
http://debian.ihug.com.au/debian/
Choosing a non-US Debian mirror using netselect.
Running netselect to choose 1 out of 72 addresses.
.....................................................
The fastest non-US server seems to be:
http://194.97.2.70/debian-non-US/
Writing sources.list.
Done.
好了,看了看文件内容:
0$ cat sources.list
# the main Debian packages.
deb http://debian.ihug.com.au/debian/ unstable main contrib
# Uncomment the deb-src line if you want 'apt-get source'
# to work with most packages.
# deb-src http://debian.ihug.com.au/debian/ unstable main contrib
# the non-US Debian packages.
deb http://194.97.2.70/debian-non-US/ unstable/non-US main contrib
# Uncomment the deb-src line if you want 'apt-get source'
# to work with most non-US packages
# deb-src http://194.97.2.70/debian-non-US/ unstable/non-US main contrib
4、把它加到/etc/apt/sources.list中,update一下:
0$ sudo apt-get update
获取:1 http://194.97.2.70 unstable/non-US Release.gpg [197B]
获取:2 http://debian.ihug.com.au unstable Release.gpg [197B]
获取:3 http://debian.cn99.com unstable Release.gpg [197B]
获取:4 http://debian.ihug.com.au unstable Release [34.1kB]
获取:5 http://debian.ihug.com.au unstable/main Packages [2851kB]
获取:6 http://194.97.2.70 unstable/non-US Release [21.5kB]
忽略 http://194.97.2.70 unstable/non-US Release
命中 http://debian.cn99.com unstable Release
忽略 http://194.97.2.70 unstable/non-US/main Packages
命中 http://debian.cn99.com unstable/main Packages
忽略 http://194.97.2.70 unstable/non-US/contrib Packages
命中 http://debian.cn99.com unstable/non-free Packages
命中 http://debian.cn99.com unstable/contrib Packages
命中 http://debian.cn99.com unstable/main Sources
命中 http://debian.cn99.com unstable/non-free Sources
命中 http://debian.cn99.com unstable/contrib Sources
获取:7 http://debian.ihug.com.au unstable/contrib Packages [55.8kB]
获取:8 http://194.97.2.70 unstable/non-US/main Packages [5116B]
获取:9 http://194.97.2.70 unstable/non-US/contrib Packages [20B]
下载 2968kB,耗时 30s (97.2kB/s)
正在读取软件包列表... 完成
W: GPG error: http://194.97.2.70 unstable/non-US Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B629A24C38C6029A
W: 您可能需要运行 apt-get update 来解决这些问题
还真是挺快的,下载很轻松就可以达到几百K的速度;就是得解决一下public key的问题。哈哈,前一阵子记的笔记这回派上用场了:
0$ gpg --keyserver wwwkeys.eu.pgp.net --recv-keys B629A24C38C6029A
gpg: 下载密钥‘38C6029A’,从 hkp 服务器 wwwkeys.eu.pgp.net
gpg: 密钥 38C6029A:公钥“Debian Archive Automatic Signing Key (2003)”已导入
gpg: 需要 3 份勉强信任和 1 份完全信任,classic 信任模型
gpg: 深度:0 有效性: 1 已签字: 0 信任度:0-,0q,0n,0m,0f,1u
gpg: 下次信任度数据库检查将于 2006-03-07 进行
gpg: 合计被处理的数量:1
gpg: 已导入:1
0$ gpg --armor --export B629A24C38C6029A | sudo apt-key add -
gpg: 没有找到任何绝对信任的密钥
OK
好了,以后我再装新软件随时都可以享受高速的感觉了 :)
2 条评论:
来来来,先收藏起来。
我也是使用记录下来,方便别人,也方便自己下次查了,呵呵。
发表评论