apt: autoselect best mirror
To speed up package downloads we can add the following to our sources.list and apt will automatically find the fastest mirror for us.
Note: If youre running a different version of Ubuntu replace 'xenial' with your distributions codename. (DISTRIB_CODENAME
in /etc/lsb_release
)
The following command automates this:
sed -i.bak
'
deb mirror://mirrors.ubuntu.com/mirrors.txt xenial main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-updates main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-backports main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-security main restricted universe multiverse
'
> /etc/apt/sources.list
Then update the repository cache using apt update
.