You can use find-mirrors.sh to find alternative repository mirrors for Ubuntu. It will check mirror lists and test the mirrors to see if they're working or not.
When it finds mirrors that are compatible with your preferences, it will output the mirrors in Apt's sources.list format.
The script also allows you to find Ubuntu mirrors for different architectures like:
- ARM (
armhf&arm64) - RISC-V (
riscv64) - PPC (
ppc64el) - IBM Z (
s390x)
$ export URL="https://raw.githubusercontent.com/alexdelorenzo/find-ubuntu-mirrors/master/find-mirrors.sh"
$ curl -Ls "$URL" | bashThe script takes the following positional arguments or environment variables:
| Position | Variable name | Description | Default value |
|---|---|---|---|
| 1 | $ARCH |
Architecture that the mirrors support | amd64 |
| 2 | $DISTRO |
Version of Ubuntu the mirrors support | focal |
| 3 | $REPOSITORY |
The apt repository |
main |
| 4 | $PROTOCOL |
The apt repository protocol |
http |
| 5 | $JOBS |
Number of concurrent connections that the script makes | 4 |
Here's the syntax:
$ curl -Ls "$URL" | bash -s $ARCH $DISTRO $REPOSITORY $PROTOCOL $JOBSIf you want to find alternatives for arm64 architectures while checking 6 repositories concurrently, you can do this:
$ curl -Ls "$URL" | bash -s arm64 focal main http 6You can also use environment variables instead:
$ export ARCH=arm64 DISTRO=focal JOBS=6
$ curl -Ls "$URL" | bashThe script will output the mirrors it finds in Apt's sources.list format:
$ curl -Ls "$URL"
deb http://mirror.kumi.systems/ubuntu-ports/ focal main
deb-src http://mirror.kumi.systems/ubuntu-ports/ focal main
deb http://mirrors.portafixe.com/ubuntu/archive/ focal main
deb-src http://mirrors.portafixe.com/ubuntu/archive/ focal main
...- Bash
- GNU
parallel htmlq- HTTPie