Set Up Arch Linux Mirrors
Optimize your mirrors for faster package updates. Choose one of these methods:
INFO
Reflector
→ Automatically find and rank mirrors (recommended).Mirrorlist Generator
→ Select mirrors manually.Rankmirrors
→ Rank mirrors by speed usingpacman-contrib
.
1. Using Reflector (Recommended)
reflector
automatically updates and ranks mirrors.
Install Reflector
shell
sudo pacman -S reflector
Backup Your Mirrorlist
shell
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
Use Reflector to Rank Mirrors
Run this command (replace 'Germany'
with your country):
shell
sudo reflector --country 'Germany' --latest 5 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
Config Info:
--country
→ Mirrors in your location.--latest 5
→ Use latest 5 synced mirrors.--protocol https
→ Use HTTPS mirrors.--sort rate
→ Rank mirrors by speed.
Verify the Mirrorlist
shell
cat /etc/pacman.d/mirrorlist
Automate Reflector (Optional)
Create a configuration file:
shellsudo nano /etc/xdg/reflector/reflector.conf
Example:
--country 'United States' --latest 5 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
Enable the service:
shellsudo systemctl enable --now reflector.service
Refresh the Database
shell
sudo pacman -Syy
2. Using the Arch Linux Mirrorlist Generator
INFO
- Visit the mirrorlist generator.
- Select your country/region and customize options.
- Generate and copy/download the mirrorlist.
Backup and Replace the Mirrorlist
- Backup your current list:shell
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
- Edit the file and paste the list:shell
sudo nano /etc/pacman.d/mirrorlist
- Uncomment all mirrors manually or using:shell
sudo sed -i 's/^#Server/Server/' /etc/pacman.d/mirrorlist
Refresh the Database
shell
sudo pacman -Syy
3. Using Rankmirrors with Pacman-Contrib
rankmirrors
ranks mirrors by speed.
Install pacman-contrib
shell
sudo pacman -S pacman-contrib
Backup Your Mirrorlist
shell
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
Uncomment All Mirrors
- Edit the file:shell
sudo nano /etc/pacman.d/mirrorlist
- Or uncomment automatically:shell
sudo sed -i 's/^#Server/Server/' /etc/pacman.d/mirrorlist
Rank the Mirrors
Save the top 10 mirrors:
shell
rankmirrors -n 10 /etc/pacman.d/mirrorlist | sudo tee /etc/pacman.d/mirrorlist
Refresh the Database
shell
sudo pacman -Syy