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