Skip to content

Find The Fastest Arch Linux Reposity Mirror(s) With Rankmirrors

 

I setup a new Desktop at work today and I thought I’d try out Arch again.  I’ve had it running on my work Laptop for a few months now, but there were some things I wanted to figure out and learn, “The Arch Way”.  One of the little tips that I found in my continued reading and setting up was the use of the rankmirrors tool.  Rankmirrors will find and configure your system to use the fastest repository mirrors for your connection.

Getting Started

Let’s assume you’re on a fresh installation.  If not, the steps are really the same, you just likely don’t have to worry about resolving the dependencies.  So, on that note, the only dependency for the tool is python.  If you don’t have python installed (which is likely only the case if you’re on a fresh installation), you’ll need to install it:

pacman -S python<br />

Running Rankmirrors

Rankmirrors will read a copy of the mirrorlist file and output an updated, ranked mirrorlist file.  To do this cleanly, in the fewest steps, well move the original file which is what we’ll read from and then output to the file we’ll end up using.

mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig<br /> rankmirrors -n 3 /etc/pacman.d/mirrorlist.orig > /etc/pacman.d/mirrorlist<br />

This will take a little time to run through the list and compare the results, but when it is finished you’ll have a mirrorlist file that is optimized for your connection.  You’ll also notice that I used the “-n3” option, which tells it to output the three fastest repository mirrors.  You can change this number based on your needs.

Also, anytime you update or change your repository mirror you’ll want to make sure pacman is updated accordingly.  Run the following command anytime you make changes to your mirror:

pacman -Syy<br />