How do you select the fastest mirror from the command line?
Posted
by
Evan
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Evan
Published on 2011-05-04T06:35:12Z
Indexed on
2012/06/19
9:24 UTC
Read the original article
Hit count: 319
I want to update my sources.list file with the fastest server from the command line in a fresh Ubuntu Server install. I know this is trivially easy with the GUI, but there doesn't seem to be a simple way to do it from from the command line?
There are two different working answers to this question below:
- Use apt-get's
mirror:method
This method asks the Ubuntu server for a list of mirrors near you based on your IP, and selects one of them. The easiest alternative, with the minor downside that sometimes the closest mirror may not be the fastest.- Command-line foo using netselect
Shows you how to use the netselect tool to find the fastest recently updated servers from you -- network-wise, not geographically. Usesedto replace mirrors insources.list.
The other answers, including the accepted answer, are no longer valid (for Ubuntu 11.04 and newer) because they recommended Debian packages such as
netselect-aptandapt-spywhich do not work with Ubuntu.
Use sed to replace mirrors in sources.list
sudo sed -i -e 's#us.archive.ubuntu.com/mirror.math.ucdavis.edu#g' /etc/apt/sources.list
© Ask Ubuntu or respective owner