Select Fastest Debian Mirror for apt-get

By | 2011/05/15

With Debian you can easily auto-detect the fastest mirror for apt-get!


First install this package:

$ sudo apt-get install netselect-apt

Then run the following, adjusting for your desired version. I’m using LMDE, so I’m going to run:

$ sudo netselect-apt testing

Other examples:

sudo netselect-apt [stable|testing|unstable|experimental|release_codename|sid]
01netselect 02netselect

This will query various debian mirrors then leave a file sources.list in your current working directory.

03netselect
You can now manually update your /etc/apt/sources.list with the fastest mirror found for your system.

$ sudo nano /etc/apt/sources.list

Only replace the existing line

deb http://[___]debian.org/debian stable main contrib

with your new mirror. Leave others such as security.debian.org and third party repos as they are.

04netselect

Sweet!

8 thoughts on “Select Fastest Debian Mirror for apt-get

  1. gavin

    Do you know how I could do the same on Ubuntu? I cannot seem to install it:

    $ sudo apt-get install netselect-apt
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package netselect-apt is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘netselect-apt’ has no installation candidate

    Reply
    1. Mascha Xenos

      Download the source from a http:// repo and compile the tool on ubuntu.
      Many good debian-tools are not available in ubuntu since they are replaced by tools from the ubuntu-repo or just not done for ubuntu (yet).
      But I just thought, that I read somewhere, that a similar tool is available… still don’t remember the name.

      Maybe google helps, too 😉

      Reply
      1. sh4

        Just use Debian or at least LMDE (Linux Mint Debian Edition).

        Reply
  2. sh4

    Scott did you know that you can rename (or remove) the current sources.list before running the netselect?

    $ sudo mv /etc/apt/sources.list /etc/apt/sources.bak
    $ sudo netselect-apt sid

    Way long easier!

    Greets

    Reply
    1. sh4

      Forgot to say that renaming/removing the sources.list will generate the sources.list automatically for you.

      Reply
  3. Lutter

    When I just did the above, it seems the fastest mirrors are testing sites, which means that I went from 5 available updates with my old configuration for apt, to about 585!
    Perhaps it is due to my distribution MX-14, which only has a US-server for debian.org and no servers more close by to home.
    That is to say the fastest server is perhaps not serving you with stable packages but developer-packages.

    Reply
  4. texbrew

    Thanks for this.

    My mirror site became unreachable, so no updates (or anything else).

    And of course, I hadn’t backed up Debian’s original sources list. Your tips got me back on track.

    tex

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.