> ## Content Index
> Fetch the complete content index at: https://itsfoss.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Finding the Fastest Arch Linux Mirrors
- URL: https://itsfoss.com/fast-arch-linux-mirrors/
- Published: 2024-05-12T11:07:23.000Z
- Updated: 2024-05-12T11:07:22.000Z
- Description: Two ways to find the fastest Arch Linux mirrors. Check them out here!
- Author: Sagar Sharma
- Tags: Arch Linux

So, you [installed Arch Linux](https://itsfoss.com/install-arch-linux/), but find downloading updates/packages a bit slow. Well, unless you have a network issue, it is an easy fix by selecting the fastest mirror.

Unlike Ubuntu, where you get a GUI utility to find and enable the fastest mirrors, things are a bit different in the Arch universe.

In this tutorial, I will walk you through multiple ways you can find the fastest mirrors in Arch Linux.

## Getting the fastest mirrors in Arch Linux

For those who do not know, the mirrors are copies of the official Arch Linux repositories hosted on a server closer to your location.

This way, you can download packages faster through a mirror closer to you.

The mirror list is stored inside the `/etc/pacman.d/mirrorlist` file (in case you're curious).

To ensure that you use the fastest mirrors, there are two ways to go about it:

- **Using the rate-mirrors utility**
- **Using the Reflector utility**

Before start changing the mirrors file, it is always good to save a backup of the current file. Thus, if anything unexpected happens, you can easily revert.

```
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
```

So let's start with the first one.

### Method 1: Using the rate-mirrors utility 

The first step is to install the rate-mirrors utility which can be done using any AUR helper. 

I am going with yay here:

```
yay -S rate-mirrors-bin
```

This is the only command where you have to specify the name of your distro to proceed as it is crafted for each Arch-based distro separately.

For that, once installed, execute the `rate-mirrors` command, and it will show you the list of the distros under the `commands` section:

```
rate-mirrors
```

![Execute the rate-mirrors command to get options for the utility](https://itsfoss.com/content/images/2024/01/image-25.png)

The `rate-mirrors` utility commands

Find the name of your distro, and type in the same through the command in the following format:

```
rate-mirrors <distro-name>
```

For example, here, I'm using Arch, I will be using the following:

```
rate-mirrors arch
```

![The rate mirrors utility listing the mirrors according to the provided distribution code](https://itsfoss.com/content/images/2024/01/image-27.png)

Listing mirrors by the rate-mirrors utility

If you notice the output carefully, it only prints the actual server list without comments, so you can redirect the entire output to the file without any errors.

By default, it will also include the `http` mirrors which you may not want due to security reasons. 

You can filter the protocol and show the HTTPS servers only using the `--protocol` flag:

```
rate-mirrors --protocol https <distro_name> 
```

My command would look like this:

```
rate-mirrors --protocol https arch
```

Finally, to add the mirrors to the `/etc/pacman.d/mirrorlist` file, you will have to use the `--allow-root` flag as you need superuser privileges to change the file.

Furthermore, you have to pipe it with the tee and [grep command](https://linuxhandbook.com/what-is-grep/?ref=itsfoss.com).

The grep command will only add lines that do not start with the hashtag (to keep the file neat) and [the tee command](https://linuxhandbook.com/tee-command/?ref=itsfoss.com) will send the output to the file:

```
rate-mirrors --allow-root --protocol https <distro_name> | grep -v '^#' | sudo tee /etc/pacman.d/mirrorlist
```

Here's how it will look like:

```
rate-mirrors --allow-root --protocol https arch | grep -v '^#' | sudo tee /etc/pacman.d/mirrorlist

```

Once done, use the cat command to print the contents of the `/etc/pacman.d/mirrorlist` to verify whether the fastest mirrors are added or not:

```
cat /etc/pacman.d/mirrorlist
```

![Add fastest mirrors in arch linux. After that, list the contents of the mirrorlist file ](https://itsfoss.com/content/images/2024/01/image-28.png)

Contents of mirrorlist file

And, it is done! Now, moving on to the second method!

### Method 2: Using reflector utility

The major benefit of using reflector over the rate-mirrors is the options you get to choose. So if you want more control over how you want to select mirrors, then you cannot go wrong with a reflector. 

First, install `reflector` in Arch using the following command:

```
sudo pacman -S reflector
```

Once done, there are two ways to get the fastest mirrors using the reflector: either specify the **geographical location** or **let the reflector decide for you**.

##### Adding mirrors based on geographical location 

To specify the geographical location, use the `-c` flag, and you can do that multiple times if you want to add multiple nations:

```
sudo reflector -c <country_name> -l <number of mirrors> -p <protocol> --save /etc/pacman.d/mirrorlist 
```

Here, 

- `-c <country_name>`: specify the name of the country, closest to you.
- `-l <number of mirrors>`: here you specify the number of the most recently synchronized mirrors.
- `-p <protocol>`: specify the protocol you want to use.
- `--save /etc/pacman.d/mirrorlist`: saves the generated mirrors to the target file.

📋

You can also add multiple nations by using the `-c <country_name>` multiple times.

For example, here, I will add 20 mirrors for India using the HTTPS protocol:

```
sudo reflector -c india -l 20 -p https --save /etc/pacman.d/mirrorlist 
```

![Using reflector to add mirrors by specifying the country, number of mirrors to be included and protocol](https://itsfoss.com/content/images/2024/01/image-29.png)

Get the fastest mirrors using the geographical location

If you notice, it only added 3 mirrors because no other mirrors exist for India.

So if you want more mirrors, you will have to specify more countries, like I did here by adding mirrors for the US and China:

```
sudo reflector -c india -c us -c cn -l 20 -p https --save /etc/pacman.d/mirrorlist 
```

![Add fastest mirrors from multiple countries in Arch Linux using reflector utility](https://itsfoss.com/content/images/2024/01/image-30.png)

Add fastest mirrors from multiple countries in Arch Linux

💡

It is good to add more than one closest country to the mirrors list.

To get the list of countries and their respective codes, you can use the command:

```
reflector --list-countries
```

![List of countries and their codes in reflector](https://itsfoss.com/content/images/2024/04/reflector-list-the-countries-to-get-codes-2.png)

List of countries in reflector

#### Adding mirrors irrespective of country 

Here, you don't use the `-c` flag to specify the country but add the most recent mirrors irrespective of your geographical location.

In simple terms, you skip the `-c` flag and add global mirrors as shown here:

```
sudo reflector -l <number of mirrors> -p <protocol> --save /etc/pacman.d/mirrorlist 
```

It is an automatic selection of mirrors that may/may not be the closest.

For example, here, I added the 20 most recently synced mirrors over the HTTPS protocol:

```
sudo reflector -l 20 -p https --save /etc/pacman.d/mirrorlist 
```

![Using reflector's automatic selection of mirrors in Arch Linux](https://itsfoss.com/content/images/2024/01/image-31.png)

Reflector automatic mirror selection

## New Arch user? Explore more!

If you are here, I assume that you are new to Arch Linux (or just looking for a refresher). Nevertheless, I recommend you to keep exploring if you are an Arch Linux user.

Maybe, you can start with trying interesting [alternatives to AUR](https://itsfoss.com/best-aur-helpers/):

[Yaourt is Dead! Use These Alternatives for AUR in Arch LinuxYaourt had been the most popular AUR helper, but it is not being developed anymore. In this article, we list out some of the best alternatives to Yaourt for Arch-based Linux distributions.![](https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png)It's FOSSAbhishek Prakash![](https://itsfoss.com/content/images/wordpress/2018/06/no-yaourt-arch.jpeg)](https://itsfoss.com/best-aur-helpers/)

Or, want to [install a GUI package manager like Pamac](https://itsfoss.com/install-pamac-arch-linux/)?

[How to Install Pamac GUI Package Manager in Arch LinuxMissing a software center in Arch Linux? You can install and use Manjaro’s Pamac package manager in Arch without much trouble.![](https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png)It's FOSSAnuj Sharma![](https://itsfoss.com/content/images/wordpress/2022/07/install-pamac-on-arch.png)](https://itsfoss.com/install-pamac-arch-linux/)

If you feel a little adventurous and up for a challenge, you can [change kernels in Arch Linux](https://itsfoss.com/switch-kernels-arch-linux/):

[Zen or LTS: Switch Kernels in Arch LinuxYou can install a hardened kernel or go with the LTS kernel. Here are various kinds of kernels available for Arch Linux and the steps to use them.![](https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png)It's FOSSDimitrios![](https://itsfoss.com/content/images/wordpress/2020/10/arch-linux-kernels.png)](https://itsfoss.com/switch-kernels-arch-linux/)

*💬 Any thoughts? Share them in the comments down below!*