LinuxCommandLibrary

netselect-apt

Find fastest Debian/Ubuntu mirror for apt

TLDR

Create sources.list using the lowest latency server

$ sudo netselect-apt
copy

Specify Debian branch, stable is used by default
$ sudo netselect-apt [testing]
copy

Include non-free section
$ sudo netselect-apt [[-n|--non-free]]
copy

Specify a country for the mirror list lookup
$ sudo netselect-apt [[-c|--country]] [India]
copy

SYNOPSIS

netselect-apt [options] [suite]

PARAMETERS

-a
    Detect automatically the current APT architecture and use it for the mirror.

-s
    Force a specific APT suite.

-n
    Number of mirrors to be added to sources.list. Default is 1.

-o
    Specify the output file for the generated sources.list. Default is stdout.

--list
    Lists available suites.

--source-list
    Read the list of mirrors from the file.

-h
    Show help message and exit.

DESCRIPTION

netselect-apt is a utility designed to help users identify the fastest available mirror server for their Debian or Ubuntu apt package manager. It accomplishes this by pinging a list of potential mirror servers and measuring the round-trip time. The command then outputs a sources.list file tailored to the fastest server, allowing for significantly improved package download speeds. The utility supports architecture detection to provide optimized mirrors. It enhances the package management experience by simplifying the mirror selection process which can be crucial for fast updates and installations. By automating the selection of the best mirror, netselect-apt optimizes software installation speed and ensures efficient package downloads which improves the entire linux experience.

CAVEATS

The speed measured is only for ICMP packets. Real download speeds may vary due to network congestion and server load. Using netselect-apt too frequently might cause your IP to be temporarily blocked by some mirrors.

HOW IT WORKS

netselect-apt works by reading a list of potential mirror servers, typically from a file in /etc/apt/sources.list.d or a default list compiled into the tool. It then sends ICMP ping requests to each server and measures the round-trip time (RTT). The servers with the lowest RTT are considered the fastest and are included in the generated sources.list file. The tool automatically formats the entries in sources.list with the correct syntax.

SEE ALSO

apt(8), apt-get(8), sources.list(5)

Copied to clipboard