Use pacman-mirrors to Set the Fastest Download Server
- 1 Overview
- 2 The recommended way
- 3 Synchronizing your database
- 4 Optional: Inspect the contents of the revised mirrorlist
- 5 See Also
Pacman-mirrors complete reference
On the page Pacman-mirrors you will find a complete reference and detailed examples of its possible use.
On the webpage http://repo.manjaro.org you can see the status of every mirror serving Manjaro packages.
The official Manjaro repositories (also known as mirrors) are hosted on Software Servers. Physically located throughout the world, these servers are responsible for receiving requests for software packages via the terminal and/or pacman-gui, and consequently delivering them to your system. There are therefore three primary factors that will determine how fast your downloads are:
- Your internet connection
- The speed of the server itself, and
- The proximity of the server to you (i.e. how close or how far away it is)
Barring upgrading your internet package or switching providers, it is therefore potentially possible to improve the speed of downloads from the Manjaro repositories by using the pacman-mirrors -f command. This will automatically probe mirror servers available and up-to-date for your system branch and consequently update the /etc/pacman.d/mirrorlist file, placing them in order from fastest to slowest.
The Mirrorlist file is itself used by Manjaro's package manager pacman to tell it the internet addresses of the Manjaro servers in order to download updates and software applications from them. Alternatively, it is possible to manually determine which server(s) to use, by using the Change to a Different Download Server guide.
The recommended way
To run the pacman-mirrors app, you will need root privileges to do so, otherwise permission will be denied.
Using pacman-mirrors --fasttrack [number]
The preferred way of getting servers for your mirror list is to use the -fasttrack [number] or -f [number] argument. This ensures you connect to a server with the latest software. The [number] is the number of servers you want written to your mirror list. The default is using all up-to-date mirrors for your branch. To optionally limit the number of mirrors probed supply a positive integer after --fasttrack.
Example - all mirrors
sudo pacman-mirrors --fasttrack && sudo pacman -Syyu
Example - limit to 10 mirrors
sudo pacman-mirrors --fasttrack 10 && sudo pacman -Syyu
Pacman-mirrors will download a status file from the mirror service URL.
From that file you will get 10 random mirrors that have updated software for your current branch.
The 10 mirrors will be sorted by their current response times and written to the mirror list.
Using pacman-mirrors --country
sudo pacman-mirrors --country Costa_Rica && sudo pacman -Syyu
Works like pacman-mirrors --fasttrack, but with the search confined to the country or countries of your choice.
Use a space ( ) or (,) to seperate multiple countries, and an underscore (_) for spaces in a country's name.
sudo pacman-mirrors --country United_Kingdom Ireland Sweden && sudo pacman -Syyu
The above example will create a list of mirrors from those 3 countries and sort them according to response time.
Using pacman-mirrors --interactive
sudo pacman-mirrors --interactive && sudo pacman -Syyu
It works like pacman-mirrors --fasttrack, except it now works in interactive mode. You are be able to choose your preferred mirrors.
Be aware that the result not only is a custom mirrorlist but also a custom mirror file and if present it will always be used when running pacman-mirrors.
Reset custom mirror file and list
To reset a custom mirror file you have 2 options where the latter recreates the custom mirror file:
sudo pacman-mirrors --country all && sudo pacman -Syyu
sudo pacman-mirrors --interactive --default && sudo pacman -Syyu
Then you are be able to renew the list!
Synchronizing your database
Your Manjaro system has a database of all the software packages that are available from the official repositories. These repositories are used by pacman to locate and download packages from them for installation. Synchronizing your database after amending the mirrorlist is the final step in this process. Synchronizing will ensure that your system's database is up to date as well as help to avoid any potential problems when downloading software packages going forward.
Remember to syncronize and update system with the new mirror list. To do so enter the following command in the terminal:
sudo pacman -Syyu
Once the /etc/pacman.d/mirrorlist has been reordered and the database synchronized, the desired changes will be in effect (there is no need to reboot your system).
Optional: Inspect the contents of the revised mirrorlist
The updated mirrorlist will be saved as /etc/pacman.d/mirrorlist
To view or edit this file see Viewing and editing configuration files