Prologue
-
Raspbian には 2 つのリポジトリがある。
-
apt upgrade
で遅くて困るのは大抵 2. の方。- kernel や chromium-browser など、デカい package が多い。
-
- のように、勝手に近場のミラーを参照してくれない。※
- ※近場のミラーが無いため?
TD;LR
-
/etc/apt/sources.list.d/raspi.list
を以下のように修正しましょう。- は stretch の場合です
-deb http://archive.raspberrypi.org/debian/ stretch main ui
+deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/ stretch main ui
ミラーサーバーの比較検討
ご注意
- 比較は ping の ack にかかる時間を見ているだけなので、
実際のダウンロード速度とは必ずしも関係がありません。- 悪しからずご了承ください
1. archive.raspberrypi.org
- official さんです。いつもお世話になっております。
$ nslookup archive.raspberrypi.org
Server: 2001:ce8:116:261f::1
Address: 2001:ce8:116:261f::1#53
Non-authoritative answer:
archive.raspberrypi.org canonical name = lb.raspberrypi.org.
Name: lb.raspberrypi.org
Address: 93.93.130.214
Name: lb.raspberrypi.org
Address: 93.93.130.39
Name: lb.raspberrypi.org
Address: 46.235.231.111
Name: lb.raspberrypi.org
Address: 93.93.135.188
Name: lb.raspberrypi.org
Address: 93.93.128.133
Name: lb.raspberrypi.org
Address: 93.93.130.104
Name: lb.raspberrypi.org
Address: 93.93.128.211
Name: lb.raspberrypi.org
Address: 93.93.128.230
Name: lb.raspberrypi.org
Address: 46.235.227.11
- さすがに一手に引き受けているだけあってロードバランスされてそう
$ ping -c 4 93.93.130.214
PING 93.93.130.214 (93.93.130.214): 56 data bytes
64 bytes from 93.93.130.214: icmp_seq=0 ttl=45 time=260.093 ms
64 bytes from 93.93.130.214: icmp_seq=1 ttl=45 time=260.088 ms
64 bytes from 93.93.130.214: icmp_seq=2 ttl=45 time=259.821 ms
64 bytes from 93.93.130.214: icmp_seq=3 ttl=45 time=266.456 ms
--- 93.93.130.214 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 259.821/261.615/266.456/2.797 ms
- avg: 261.615 ms
$ ping -c 4 46.235.231.111
PING 46.235.231.111 (46.235.231.111): 56 data bytes
64 bytes from 46.235.231.111: icmp_seq=0 ttl=41 time=261.321 ms
64 bytes from 46.235.231.111: icmp_seq=1 ttl=41 time=265.325 ms
64 bytes from 46.235.231.111: icmp_seq=2 ttl=41 time=258.463 ms
64 bytes from 46.235.231.111: icmp_seq=3 ttl=41 time=262.659 ms
--- 46.235.231.111 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 258.463/261.942/265.325/2.472 ms
- avg: 261.942 ms
2. mirrors.ustc.edu.cn
- 見つけた中では最も近場の CN さん
$ nslookup mirrors.ustc.edu.cn
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: mirrors.ustc.edu.cn
Address: 202.141.176.110
Name: mirrors.ustc.edu.cn
Address: 218.104.71.170
$ ping -c 4 202.141.176.110
PING 202.141.176.110 (202.141.176.110): 56 data bytes
64 bytes from 202.141.176.110: icmp_seq=0 ttl=47 time=114.302 ms
64 bytes from 202.141.176.110: icmp_seq=1 ttl=47 time=117.460 ms
64 bytes from 202.141.176.110: icmp_seq=2 ttl=47 time=116.605 ms
64 bytes from 202.141.176.110: icmp_seq=3 ttl=47 time=114.785 ms
--- 202.141.176.110 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 114.302/115.788/117.460/1.292 ms
- さすが、ご近所さんです!
$ ping -c 4 218.104.71.170
PING 218.104.71.170 (218.104.71.170): 56 data bytes
64 bytes from 218.104.71.170: icmp_seq=0 ttl=47 time=76.374 ms
64 bytes from 218.104.71.170: icmp_seq=1 ttl=47 time=73.496 ms
64 bytes from 218.104.71.170: icmp_seq=2 ttl=47 time=76.184 ms
64 bytes from 218.104.71.170: icmp_seq=3 ttl=47 time=76.207 ms
--- 218.104.71.170 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 73.496/75.565/76.374/1.197 ms
- もう一方は更に
3. mirror.ox.ac.uk
- オックスフォード大学 さん (UK) です。
$ nslookup mirror.ox.ac.uk
Server: 2001:ce8:116:261f::1
Address: 2001:ce8:116:261f::1#53
Non-authoritative answer:
Name: mirror.ox.ac.uk
Address: 163.1.160.163
Name: mirror.ox.ac.uk
Address: 163.1.221.67
$ ping -c 4 163.1.160.163
PING 163.1.160.163 (163.1.160.163): 56 data bytes
64 bytes from 163.1.160.163: icmp_seq=0 ttl=40 time=307.555 ms
64 bytes from 163.1.160.163: icmp_seq=1 ttl=40 time=326.474 ms
64 bytes from 163.1.160.163: icmp_seq=2 ttl=40 time=248.140 ms
64 bytes from 163.1.160.163: icmp_seq=3 ttl=40 time=265.501 ms
--- 163.1.160.163 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 248.140/286.918/326.474/31.436 ms
$ ping -c 4 163.1.221.67
PING 163.1.221.67 (163.1.221.67): 56 data bytes
64 bytes from 163.1.221.67: icmp_seq=0 ttl=41 time=351.393 ms
64 bytes from 163.1.221.67: icmp_seq=1 ttl=41 time=269.717 ms
64 bytes from 163.1.221.67: icmp_seq=2 ttl=41 time=289.034 ms
64 bytes from 163.1.221.67: icmp_seq=3 ttl=41 time=251.012 ms
--- 163.1.221.67 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 251.012/290.289/351.393/37.753 ms
- 結論:UK さんは遠い。
4. rpi.rutgers.edu
- ラトガース大学さん (US) です
$ nslookup rpi.rutgers.edu
Server: 2001:ce8:116:261f::1
Address: 2001:ce8:116:261f::1#53
Non-authoritative answer:
rpi.rutgers.edu canonical name = debian-camden.camden.rutgers.edu.
Name: debian-camden.camden.rutgers.edu
Address: 128.6.34.106
$ ping -c 4 128.6.34.106
PING 128.6.34.106 (128.6.34.106): 56 data bytes
64 bytes from 128.6.34.106: icmp_seq=0 ttl=47 time=174.724 ms
64 bytes from 128.6.34.106: icmp_seq=1 ttl=47 time=174.605 ms
64 bytes from 128.6.34.106: icmp_seq=2 ttl=47 time=174.347 ms
64 bytes from 128.6.34.106: icmp_seq=3 ttl=47 time=175.808 ms
--- 128.6.34.106 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 174.347/174.871/175.808/0.558 ms
- CN さんとの物理的な距離には及びませんでしたか。
Epilogue
-
これだけでパッケージの fetch がかなりストレスフリーになります。
- ustc.edu.cn さん多謝!
-
ただ fetch の速度が改善しても、結局インストールに時間がかかる