Reflectorを利用してArch Linuxのミラーリストを週次で自動更新するように設定します。タイマーreflector.timerが週次でreflector.serviceをキックします。即時実行したい場合はreflector.serviceを開始(start)します。

https://man.archlinux.org/man/reflector.1
https://wiki.archlinux.jp/index.php/Reflector

環境

  • Arch Linux
  • Reflector 2023-3

関連ファイル

  • Reflectorの設定ファイル
    /etc/xdg/reflector/reflector.conf
  • Arch Linuxのミラーリスト
    /etc/pacman.d/mirrorlist

構築

  1. reflectorをインストール
sudo pacman -S reflector
  1. 設定
    JapanにあるHTTPSミラーの内、最近同期した上位5サイトをダウンロード速度(rate)で並べ替えます。
/etc/xdg/reflector/reflector.conf
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Recommended Options

# Set the output path where the mirrorlist will be saved (--save).
--save /etc/pacman.d/mirrorlist

# Select the transfer protocol (--protocol).
--protocol https

# Select the country (--country).
# Consult the list of available countries with "reflector --list-countries" and
# select the countries nearest to you or the ones that you trust. For example:
# --country France,Germany
--country Japan

# Use only the most recently synchronized mirrors (--latest).
--latest 5

# Sort the mirrors by synchronization time (--sort).
# --sort age
--sort rate
  1. 週次実行設定
sudo systemctl enable --now reflector.timer

次回実行時刻はsystemctl list-timersで確認できる。

  1. 即時実行したい場合のコマンド
sudo systemctl start reflector.service