Gangmax Blog

Select and Set The Fastest Ubuntu APT Mirror by Commands

From here .

  1. Download the “netselect“ pacakge and install it.
1
2
wget http://ftp.us.debian.org/debian/pool/main/n/netselect/netselect_0.3.ds1-29_amd64.deb
sudo dkpg -i netselect_0.3.ds1-29_amd64.deb
  1. Run the following command to get the fastest apt mirrors(top 10).
1
2
3
4
5
6
7
8
9
10
11
12
sudo netselect -v -s10 -t20 `wget -q -O- https://launchpad.net/ubuntu/+archivemirrors | grep -P -B8 "statusUP|statusSIX" | grep -o -P "(f|ht)tp://[^\"]*"`

159 http://mirrors.pardisco.co/ubuntu/
165 http://mirror.arvancloud.com/ubuntu/
283 http://mirrors.pardisco.co/ubuntu/
294 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu/
305 http://linux.yz.yamagata-u.ac.jp/ubuntu/
314 http://mirror.arvancloud.com/ubuntu/
315 http://linux.yz.yamagata-u.ac.jp/ubuntu/
318 http://ftp.udx.icscoe.jp/Linux/ubuntu/
334 http://mirror.telkomuniversity.ac.id/ubuntu/
335 http://mirrors.skyshe.cn/ubuntu/
  1. Update the “/etc/apt/sources.list” file content by using the selected mirror.
1
2
sudo vi /etc/apt/sources.list
:%s/cn.archive.ubuntu.com/mirror.arvancloud.com/g
  1. Update the apt package info and upgrade.
1
2
sudo apt-get update
sudo apt-get dist-upgrade

Comments