Skip to main content

Ubuntu Archive Mirror reporting tool for apt sources configuration

Project description

Find a fast, up-to-date Ubuntu Archive Mirror.

Features

  • Tests latency to mirrors in a given country’s mirror list at mirrors.ubuntu.com.
    • 3 requests are sent to each mirror, minumum round trip time being used for rank.

  • Reports latency, status, and bandwidth capacity of the fastest mirrors in a ranked list.
    • Status and bandwidth are scraped from launchpad.

  • Generates sources.list file using new mirror.
    • New mirror can be chosen from a list or selected automatically using the top ranked mirror (default).

Installation

Target most recent release:

pip install apt-select

or:

pip3 install apt-select

Target project master branch:

pip install git+https://github.com/jblakeman/apt-select.git

or:

git clone https://github.com/jblakeman/apt-select
python apt-select/setup.py install

Invocation

$ apt-select --help
usage: apt-select [-h] [-C [COUNTRY]] [-t [NUMBER]] [-m [STATUS] | -p]
                  [-c | -l]

Find the fastest Ubuntu apt mirrors.
Generate new sources.list file.

optional arguments:
  -h, --help            show this help message and exit
  -C [COUNTRY], --country [COUNTRY]
                        specify a country to test its list of mirrors
                        used to match country list file names found at mirrors.ubuntu.com
                        COUNTRY should follow ISO 3166-1 alpha-2 format
                        default: US
  -t [NUMBER], --top-number [NUMBER]
                        specify number of mirrors to return
                        default: 1
  -m [STATUS], --min-status [STATUS]
                        return mirrors with minimum status
                        choices:
                           up-to-date
                           one-day-behind
                           two-days-behind
                           one-week-behind
                           unknown
                        default: up-to-date
  -p, --ping-only       rank mirror(s) by latency only, disregard status(es)
                        cannot be used with -m/--min-status
  -c, --choose          choose mirror from a list
                        requires -t/--top-num NUMBER where NUMBER > 1
  -l, --list            print list of mirrors only, don't generate file
                        cannot be used with -c/--choose

The exit code is 0 on success, 1 on error, and 4 if sources.list already has the chosen
mirror and a new one was not generated.

Examples

Get the top mirror from the United Kingdom to generate a new sources.list::

apt-select --country GB

Choose from the top 3 mirrors, including those last updated a week ago::

apt-select -c -t 3 -m one-week-behind

Find the top 10 mirrors, output latency info only, and don’t generate new sources.list::

apt-select -t 10 -p -l

After new sources.list is generated in current working directory, backup and replace to update apt::

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup && \
sudo mv sources.list /etc/apt/

Supported URI Types

Currently, http, https and ftp are supported.

/etc/apt/sources.list should contain sources in the following format::

[deb|deb-src] [http|https|ftp]://mirror.example.com/path [component1] [component2] [...]

Dependencies

Python HTML parser, BeautifulSoup.

HTTP Requests library, requests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apt-select-2.2.1.tar.gz (12.7 kB view details)

Uploaded Source

Built Distributions

apt_select-2.2.1-py3.7.egg (27.6 kB view details)

Uploaded Source

apt_select-2.2.1-py2.py3-none-any.whl (14.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file apt-select-2.2.1.tar.gz.

File metadata

  • Download URL: apt-select-2.2.1.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for apt-select-2.2.1.tar.gz
Algorithm Hash digest
SHA256 f59234eeb8919b0a4651cbf4d807397d407d6c89773255a5add9dcee20ce21e4
MD5 90104ae861933be6a23635e06f40298b
BLAKE2b-256 4702e81dc2114817e1aa02110f8e8ae3de6f14ec1ff25be3828e37741d7c3b29

See more details on using hashes here.

File details

Details for the file apt_select-2.2.1-py3.7.egg.

File metadata

  • Download URL: apt_select-2.2.1-py3.7.egg
  • Upload date:
  • Size: 27.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for apt_select-2.2.1-py3.7.egg
Algorithm Hash digest
SHA256 7463f3acf09a84e236b2952297e48e40930d52614b2372af0e15f226e401b8d9
MD5 59dcafb671f778de337c038b8f411cb9
BLAKE2b-256 3a9f9ceb3ac213149f8121d9b62c04a30f18b7a9ae5b105f147a68db68a4598b

See more details on using hashes here.

File details

Details for the file apt_select-2.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: apt_select-2.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for apt_select-2.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7139c0076f5fccd8599b2fa6ec45a4a8326c0826803ae0aa749ed51a5a903377
MD5 21eb14d18b1d909d9eef6998f6603d51
BLAKE2b-256 988336b72b6a5bd6ac5c37854cfc3baa4b111f568818cd92973681bd2f7dfa69

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page