Ubuntu Server: Easy Fastest Repository Mirror Script
The Problem Manually finding and configuring the fastest Ubuntu repository mirror is a bit of a hassle to do. It typically involves editing system configuration files. This process is not only time-consuming but error-prone, especially when you're managing multiple servers or need to optimize performance quickly. The Solution I created a simple but powerful script that automates the entire process: Tests Ubuntu repository mirrors based on your geographical location Measures actual download speeds from each mirror Identifies the fastest mirrors available to you Automatically updates your system to use the best mirror Safely backs up your original configuration Getting Started Getting the script is easy: curl -O https://raw.githubusercontent.com/ijash/ubuntu-fastest-mirror/master/run.sh chmod +x run.sh Basic Usage For the simplest experience, just run the script: ./run.sh The script will: Find mirrors near your location Test their download speeds Present the top 5 fastest mirrors Let you choose which one to use Advanced Usage Need more control? The script offers several useful options: ./run.sh -b -c JP US -s 200 This command: -b Creates a backup of your current sources.list -c JP US Tests mirrors specifically from Japan and the United States -s 200 Uses a 200KB sample size for more accurate speed testing Want the script to automatically select the fastest mirror without prompting? ./run.sh -a The -a flag handles everything automatically, including backing up your original configuration. How It Works Behind the scenes, the script: Downloads mirror lists from the official Ubuntu mirror directory Tests download speeds using small sample files from each mirror Ranks mirrors by actual performance (not just ping time) Safely modifies your sources.list file to use the fastest mirror Why You Should Care Using a fast, reliable mirror: Speeds up system updates and security patches Improves developer productivity Ensures consistent package availability More Information For more details and full documentation, check out the GitHub repository.

The Problem
Manually finding and configuring the fastest Ubuntu repository mirror is a bit of a hassle to do. It typically involves editing system configuration files.
This process is not only time-consuming but error-prone, especially when you're managing multiple servers or need to optimize performance quickly.
The Solution
I created a simple but powerful script that automates the entire process:
- Tests Ubuntu repository mirrors based on your geographical location
- Measures actual download speeds from each mirror
- Identifies the fastest mirrors available to you
- Automatically updates your system to use the best mirror
- Safely backs up your original configuration
Getting Started
Getting the script is easy:
curl -O https://raw.githubusercontent.com/ijash/ubuntu-fastest-mirror/master/run.sh
chmod +x run.sh
Basic Usage
For the simplest experience, just run the script:
./run.sh
The script will:
- Find mirrors near your location
- Test their download speeds
- Present the top 5 fastest mirrors
- Let you choose which one to use
Advanced Usage
Need more control? The script offers several useful options:
./run.sh -b -c JP US -s 200
This command:
-
-b
Creates a backup of your current sources.list -
-c JP US
Tests mirrors specifically from Japan and the United States -
-s 200
Uses a 200KB sample size for more accurate speed testing
Want the script to automatically select the fastest mirror without prompting?
./run.sh -a
The -a
flag handles everything automatically, including backing up your original configuration.
How It Works
Behind the scenes, the script:
- Downloads mirror lists from the official Ubuntu mirror directory
- Tests download speeds using small sample files from each mirror
- Ranks mirrors by actual performance (not just ping time)
- Safely modifies your sources.list file to use the fastest mirror
Why You Should Care
Using a fast, reliable mirror:
- Speeds up system updates and security patches
- Improves developer productivity
- Ensures consistent package availability
More Information
For more details and full documentation, check out the GitHub repository.