首先、安装netselect-apt

apt update
apt install netselect-apt -y

然后切换到/etc/apt目录,运行命令获取最优镜像。

cd /etc/apt
netselect-apt
apt update

使用netslect-apt命令后,会在目录下面生产source.list,可以用它来代替目前使用的source.list,如果目录下面已经存在source.list,则会自动备份它们。

root@ronpy:/etc/apt# netselect-apt
Using distribution stable.
Retrieving the list of mirrors from www.debian.org...

URL transformed to HTTPS due to an HSTS policy
--2020-10-16 02:46:20--  https://www.debian.org/mirror/mirrors_full
Resolving www.debian.org (www.debian.org)... 128.31.0.62, 149.20.4.15, 130.89.148.77, ...
Connecting to www.debian.org (www.debian.org)|128.31.0.62|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 168980 (165K) [text/html]
Saving to: ‘/tmp/netselect-apt.hktGJQ’

/tmp/netselect-apt.hktGJQ                                   100%[========================================================================================================================================>] 165.02K   208KB/s    in 0.8s

2020-10-16 02:46:22 (208 KB/s) - ‘/tmp/netselect-apt.hktGJQ’ saved [168980/168980]

Choosing a main Debian mirror using netselect.
netselect: 354 (23 active) nameserver request(s)...
Duplicate address 150.203.164.37 (http://mirror.linux.org.au/debian/, http://ftp.au.debian.org/debian/); keeping only under first name.
netselect: 351 (24 active) nameserver request(s)...
Duplicate address 195.234.45.114 (http://ftp.be.debian.org/debian/, http://mirror.as35701.net/debian/); keeping only under first name.
netselect: 8 (8 active) nameserver request(s).....
Duplicate address 208.80.154.15 (http://208.80.154.15/debian/, http://mirrors.wikimedia.org/debian/); keeping only under first name.
netselect: 3 (3 active) nameserver request(s)...
Duplicate address 213.129.232.18 (http://debian.sil.at/debian/, http://ftp.si.debian.org/debian/); keeping only under first name.
Running netselect to choose 10 out of 350 addresses.
................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
The fastest 10 servers seem to be:

        http://ftp2.cn.debian.org/debian/
        http://mirror.rise.ph/debian/
        http://mirror.i3d.net/debian/
        http://ftp.ntou.edu.tw/debian/
        http://ftp.tku.edu.tw/debian/
        http://mirror.0x.sg/debian/
        http://ftp.debianclub.org/debian/
        http://mirrors.ustc.edu.cn/debian/
        http://mirror.pregi.net/debian/
        http://debian.xtdv.net/debian/

Of the hosts tested we choose the fastest valid for HTTP:
        http://ftp2.cn.debian.org/debian/

Writing sources.list.
sources.list exists, moving to sources.list.1602830807
Done.

发表评论