archlinux自动选择网速较快的源

archlinux自动选择网速较快的源

什么是reflector

Reflector is a script which can retrieve the latest mirror list from the MirrorStatus page, filter the most up-to-date mirrors, sort them by speed and overwrite the file /etc/pacman.d/mirrorlist.

安装reflector脚本

1
sudo pacman -S reflector

命令运行

首先备份之前的mirrorlist

1
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup

选择https/http协议、位于中国、12小时同步的镜像,通过下载速度排序,写入到 /etc/pacman.d/mirrorlist:

1
sudo reflector --verbose --country China --age 12 --protocol https --protocol http --sort rate --save /etc/pacman.d/mirrorlist