Change Repository Mirrors From Regional to Main on Ubuntu

Change Repository Mirrors From Regional to Main on Ubuntu

When it comes to keeping the Ubuntu system up-to-date, having the right repository mirrors can significantly impact download speeds and overall system performance. Ubuntu uses mirrors around the world to distribute packages efficiently. A mirror is a copy of a repository hosted on a different server than the original. However, sometimes the default regional mirrors may not be the fastest for your location. This tutorial shows how to change repository mirrors from regional to main on Ubuntu.

We'll use the sed command to replace the regional mirror with the main server in the sources list. Execute the following command:

sudo sed -i 's/us.archive/archive/g' /etc/apt/sources.list

This command replaces occurrences of us.archive with archive in the /etc/apt/sources.list file. Adjust the mirror prefix according to your region if needed.

After modifying the sources list, we need to update the package information using the following command:

sudo apt update

This command refreshes the package list from the new repository mirrors, allowing the system to fetch the latest package information.

This simple tweak can significantly enhance the system's performance during software updates. You can explore other mirrors that might be more suitable for your location.

Leave a Comment

Cancel reply

Your email address will not be published.