Ubuntu Server: Easy Fastest Repository Mirror Script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MyrinNew
    Senior Member
    • Feb 2024
    • 5175

    #1

    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/ij.../master/run.sh
    chmod +x run.sh







    Basic Usage

    For the simplest experience, just run the script:






    ./run.sh







    The script will:

    1. Find mirrors near your location
    2. Test their download speeds
    3. Present the top 5 fastest mirrors
    4. 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:

    1. Downloads mirror lists from the official Ubuntu mirror directory
    2. Tests download speeds using small sample files from each mirror
    3. Ranks mirrors by actual performance (not just ping time)
    4. 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.




    More...
Working...