How can I generate repository mirrors on Manjaro and Arch Linux based on my Country?. Every time you’re downloading packages on Arch Linux and Manjaro, pacman uses the mirrors in the order they are listed in /etc/pacman.d/mirrorlist.

Since the priority of the mirrors is based on the order they appear in the list it is recommended to always choose mirrors close to you for better speeds. One of the metric you can use for this is selecting mirrors based on geographical location, starting from your local country.

The official Arch Linux mirror list is available from the pacman-mirrorlist package. If not present you can install with the command below.

sudo pacman -S pacman-mirrorlist

When the package is installed it will provide pacman-mirrors command line tool used to generate pacman mirrorlist for Arch and Manjaro Linux.

$ pacman-mirrors --help

It will generate mirrorlist with up-to-date mirrors ranked all by average response time.

Generate Country Specific Mirrorlist on Manjaro | Arch Linux

Run the following command to list available countries:

$ pacman-mirrors -l
Australia
Austria
Bangladesh
Belarus
Belgium
Brazil
Bulgaria
Canada
Chile
China
Costa_Rica
Czech
Denmark
France
Georgia
Germany
Greece
Hong_Kong
Hungary
Iceland
India
Indonesia
Iran
Italy
Japan
Kenya
Netherlands
New_Zealand
Norway
Pakistan
Philippines
Poland
Portugal
Russia
Singapore
South_Africa
South_Korea
Spain
Sweden
Switzerland
Taiwan
Thailand
Turkey
Ukraine
United_Kingdom
United_States
Uruguay

To generate mirrorlist using Country the syntax is:

$ sudo pacman-mirrors -c, --country COUNTRY [COUNTRY ...]

For multiple countries separate the list with comma.

As I’m based in Kenya, the command I’ll run is:

$ sudo pacman-mirrors -c Kenya
::INFO Downloading mirrors from repo.manjaro.org
::INFO User generated mirror list
::------------------------------------------------------------
::INFO Custom mirror file saved: /var/lib/pacman-mirrors/custom-mirrors.json
::INFO Using custom mirror file
::INFO Querying mirrors - This may take some time
  0.312 Kenya          : https://manjaro.mirror.liquidtelecom.com/
  0.261 Kenya          : http://manjaro.mirror.liquidtelecom.com/
::INFO Writing mirror list
::Kenya           : https://manjaro.mirror.liquidtelecom.com/stable/$repo/$arch
::INFO Mirror list generated and saved to: /etc/pacman.d/mirrorlist
::INFO To reset custom mirrorlist 'sudo pacman-mirrors -id'
::INFO To remove custom config run  'sudo pacman-mirrors -c all'

Confirm the mirrorlist file contents.

$ cat /etc/pacman.d/mirrorlist 
##
## Manjaro Linux custom mirrorlist
## Generated on 2020-12-02 21:14
##
## Please use 'pacman-mirrors -id' To reset custom mirrorlist
## Please use 'pacman-mirrors -c all' To reset custom mirrorlist
## To remove custom config run  'pacman-mirrors -c all'
##

## Country : Kenya
Server = https://manjaro.mirror.liquidtelecom.com/stable/$repo/$arch

Specifying multiple countries

The other country in Africa listed is South Africa so I can use the two countries for better availability using the command:

$ sudo pacman-mirrors -c Kenya,South_Africa
::INFO Downloading mirrors from repo.manjaro.org
::INFO User generated mirror list
::------------------------------------------------------------
::INFO Custom mirror file saved: /var/lib/pacman-mirrors/custom-mirrors.json
::INFO Using custom mirror file
::INFO Querying mirrors - This may take some time
  0.251 Kenya          : https://manjaro.mirror.liquidtelecom.com/
  0.185 Kenya          : http://manjaro.mirror.liquidtelecom.com/
  ..... South_Africa   : http://mirror.is.co.za/mirrors/manjaro.org/
  ..... South_Africa   : http://manjaro.mirror.ac.za/
::INFO Writing mirror list
::Kenya           : https://manjaro.mirror.liquidtelecom.com/stable/$repo/$arch
::South_Africa    : http://manjaro.mirror.ac.za/stable/$repo/$arch
::South_Africa    : http://mirror.is.co.za/mirrors/manjaro.org/stable/$repo/$arc
::INFO Mirror list generated and saved to: /etc/pacman.d/mirrorlist
::INFO To reset custom mirrorlist 'sudo pacman-mirrors -id'
::INFO To remove custom config run  'sudo pacman-mirrors -c all'

Check mirrorlist file contents.

$ cat /etc/pacman.d/mirrorlist 
##
## Manjaro Linux custom mirrorlist
## Generated on 2020-12-02 21:17
##
## Please use 'pacman-mirrors -id' To reset custom mirrorlist
## Please use 'pacman-mirrors -c all' To reset custom mirrorlist
## To remove custom config run  'pacman-mirrors -c all'
##

## Country : Kenya
Server = https://manjaro.mirror.liquidtelecom.com/stable/$repo/$arch

## Country : South_Africa
Server = http://manjaro.mirror.ac.za/stable/$repo/$arch

## Country : South_Africa
Server = http://mirror.is.co.za/mirrors/manjaro.org/stable/$repo/$arch

After all operations it is always a recommendation to syncronize and update your system with:

sudo pacman -Syyu

Accept upgrades by pressing the y key in your keyboard:

...
Total Download Size:   1030.43 MiB
Total Installed Size:  4023.90 MiB
Net Upgrade Size:       374.01 MiB

:: Proceed with installation? [Y/n] y

You should notice faster download speeds when doing package installations on Manjaro and any other Arch based Linux distribution you’re running. Also check other articles available in our website.

Install FreeOffice on Manjaro | Arch Linux

How To Install Zoom Client on Manjaro Linux

How To Install Docker CE on Manjaro Linux

LEAVE A REPLY

Please enter your comment!
Please enter your name here

two × 3 =