跳到网页内文区。

:::

Debian 安装 wine 或 ttf-mscorefonts-installer 的问题(Ubuntu 同解)

在 Debian 下,安装 wine 或 ttf-mscorefonts-installer 的时候,若你在台湾,会碰到以下的错误:

root@rinse:~# apt-get install wine
…
正在设定 ttf-mscorefonts-installer (3.0) ...

These fonts were provided by Microsoft "in the interest of cross-
platform compatibility".  This is no longer the case, but they are
still available from third parties.

You are free to download these fonts and use them for your own use,
but you may not redistribute them in modified form, including changes
to the file name or packaging format.

--2009-11-11 00:45:02--  http://downloads.sourceforge.net/corefonts/andale32.exe
正在查找主机 downloads.sourceforge.net... 216.34.181.59
正在连接 downloads.sourceforge.net|216.34.181.59|:80... 连上了。
已送出 HTTP 要求,正在等候回应... 302 Found
位置:http://ncu.dl.sourceforge.net/project/corefonts/the%20fonts/final/andale32.exe [跟随连结]
--2009-11-11 00:45:03--  http://ncu.dl.sourceforge.net/project/corefonts/the%20fonts/final/andale32.exe
正在查找主机 ncu.dl.sourceforge.net... 140.115.17.45
正在连接 ncu.dl.sourceforge.net|140.115.17.45|:80... 连上了。
已送出 HTTP 要求,正在等候回应... 200 OK
长度: 198384 (194K) [application/octet-stream]
Saving to: `./andale32.exe'

100%[======================================>] 198,384     40.8K/s   in 4.7s

2009-11-11 00:45:08 (40.8 KB/s) -- 已储存 ‘./andale32.exe’ [198384/198384])

--2009-11-11 00:45:08--  http://downloads.sourceforge.net/corefonts/arialb32.exe
正在查找主机 downloads.sourceforge.net... 216.34.181.59
正在连接 downloads.sourceforge.net|216.34.181.59|:80... 连上了。
已送出 HTTP 要求,正在等候回应... 302 Found
位置:http://ncu.dl.sourceforge.net/project/corefonts/the%20fonts/final/arialb32.exe [跟随连结]
--2009-11-11 00:45:09--  http://ncu.dl.sourceforge.net/project/corefonts/the%20fonts/final/arialb32.exe
正在查找主机 ncu.dl.sourceforge.net... 140.115.17.45
正在连接 ncu.dl.sourceforge.net|140.115.17.45|:80... 连上了。
已送出 HTTP 要求,正在等候回应... 200 OK
长度: 168176 (164K) [application/octet-stream]
Saving to: `./arialb32.exe'

100%[======================================>] 168,176     40.0K/s   in 4.1s

2009-11-11 00:45:13 (40.0 KB/s) -- 已储存 ‘./arialb32.exe’ [168176/168176])

--2009-11-11 00:45:13--  http://downloads.sourceforge.net/corefonts/arial32.exe
正在查找主机 downloads.sourceforge.net... 216.34.181.59
正在连接 downloads.sourceforge.net|216.34.181.59|:80... 连上了。
已送出 HTTP 要求,正在等候回应... 302 Found
位置:http://ncu.dl.sourceforge.net/project/corefonts/the%20fonts/final/arial32.exe [跟随连结]
--2009-11-11 00:45:14--  http://ncu.dl.sourceforge.net/project/corefonts/the%20fonts/final/arial32.exe
正在查找主机 ncu.dl.sourceforge.net... 140.115.17.45
正在连接 ncu.dl.sourceforge.net|140.115.17.45|:80... 失败:连线超过时间。
已放弃。

--2009-11-11 00:45:19--  http://switch.dl.sourceforge.net/sourceforge/corefonts/arial32.exe
正在查找主机 switch.dl.sourceforge.net... 130.59.138.21, 2001:620:0:1b::21
正在连接 switch.dl.sourceforge.net|130.59.138.21|:80... 连上了。
已送出 HTTP 要求,正在等候回应... 302 Found
位置:http://downloads.sourceforge.net/sourceforge/corefonts/arial32.exe?download&failedmirror=switch.dl.sourceforge.net [跟随连结]
--2009-11-11 00:45:21--  http://downloads.sourceforge.net/sourceforge/corefonts/arial32.exe?download&failedmirror=switch.dl.sourceforge.net
正在查找主机 downloads.sourceforge.net... 216.34.181.59
正在连接 downloads.sourceforge.net|216.34.181.59|:80... 连上了。
已送出 HTTP 要求,正在等候回应... 302 Found
位置:http://ncu.dl.sourceforge.net/project/corefonts/the%20fonts/final/arial32.exe [跟随连结]
--2009-11-11 00:45:21--  http://ncu.dl.sourceforge.net/project/corefonts/the%20fonts/final/arial32.exe
正在查找主机 ncu.dl.sourceforge.net... 140.115.17.45
正在连接 ncu.dl.sourceforge.net|140.115.17.45|:80... 失败:连线超过时间。
已放弃。
…

从 ncu.dl.sourceforge.net 下载到第三个字型后就挂掉了,没办法继续下载后面的字型,安装会失败。从讯息中看起来,要下载字型的时候,透过 SourceForge.net 的镜像站切换伺服器,自动依使用者在台湾,转到中央大学的镜像站。而中央大学的镜像站又有防抓站,只要连续抓超过两个档案,就会丢掉封包,无法继续下载。所以当 ttf-mscorefonts-installer 要下载一连串的字型时,下载到第三个字型就会被挡住了。因为选取哪一个镜像站是 SourceForge.net 的镜像站切换伺服器决定的,也没办法去改掉。

不过,倒有一个简单的 Hack 解法。

因为下载用的程式还是 wget , wget 还是透过系统解析取得 ncu.dl.sourceforge.net 的 IP 去下载的。只要骗 wget 到另一个 IP 下载,就可以了。台湾有另外一个频宽更大的 SourceForge.net 镜像站在国网中心 nchc.dl.sourceforge.net ,只要能骗 wget 去国网中心下载即可。

root@rinse:~# host ncu.dl.sourceforge.net
ncu.dl.sourceforge.net has address 140.115.17.45
root@rinse:~# host nchc.dl.sourceforge.net
nchc.dl.sourceforge.net has address 211.79.60.17
nchc.dl.sourceforge.net has IPv6 address 2001:e10:ffff:1f02::17
root@rinse:~# echo "211.79.60.17 ncu.dl.sourceforge.net" >> /etc/hosts
root@rinse:~# apt-get install wine

其中 echo "211.79.60.17 ncu.dl.sourceforge.net" >> /etc/hosts 是把 ncu.dl.sourceforge.net 这个主机的 IP 写死在 211.79.60.17 。这不是正确的做法,只是一个简单的 Hack ,骗过 wget 而已。安装完毕后最好把那一行删掉,以免日后网域名称解析出问题。

依玛猫,初稿 2009-11-11 ,上次更新日期 2009-11-11