ミラー

提供: ArchWiki
2015年1月5日 (月) 19:53時点におけるKusakata (トーク | 投稿記録)による版 (ページの作成:「Category:Arch について Category:パッケージ管理 ar:Mirrors en:Mirrors es:Mirrors fr:Miroirs it:Mirrors ru:Mirrors zh-CN:Mirror...」)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
ナビゲーションに移動 検索に移動

テンプレート:Related articles start (日本語)

  • ミラーリング
  • pacman
  • reflector
  • このページにはミラーの選択と設定のガイドと現在利用できるミラーのリストがあります。

    特定のミラーを有効にする

    ミラーを有効にするには、/etc/pacman.d/mirrorlist を開きあなたの国の部分を見て下さい。あなたが使いたいミラーをアンコメントします。

    ノート: ftp.archlinux.org は 50KB/s に速度を抑えられています

    例:

    # Japan
    # Server = ftp://ftp.jaist.ac.jp/pub/Linux/ArchLinux/$repo/os/$arch
    Server = http://ftp.jaist.ac.jp/pub/Linux/ArchLinux/$repo/os/$arch
    

    ミラーの選択を助けるツールについては #ミラーの状態#速度で並び替える を見て下さい。

    ヒント: 好みの5つのミラーをアンコメントしてミラーリストファイルの一番上に置いて下さい。最初のミラーに問題が起こったとしても他のミラーに移ることができるようになります。ミラーリストのアップデートをマージするのが簡単になるメリットもあります。

    /etc/pacman.conf でミラーを指定することも可能です。[core] リポジトリのデフォルトの設定は以下の通りです:

    [core]
    Include = /etc/pacman.d/mirrorlist
    

    JAIST のミラーをデフォルトのミラーとして使いたい場合、Include 行の前に次を追加してください:

    [core]
    Server = ftp://ftp.jaist.ac.jp/pub/Linux/ArchLinux/core/os/$arch
    Include = /etc/pacman.d/mirrorlist
    

    pacman は最初にこのミラーに接続を試行するようになります。同じように [testing], [extra], [community] でミラーを設定することができます。

    ノート: ミラーを直接 pacman.conf で指定する場合、全てのリポジトリで同じミラーを使うようにしてください。そうしないと、インストールされるパッケージ同士の互換性が失われます。例えば [core] の linux が最新なのに対して [extra] のカーネルモジュールが古いということがありえます。

    pacman にパッケージリストを更新させる

    /etc/pacman.d/mirrorlist を作成・編集した後は次のコマンドを実行してください:

    # pacman -Syy
    
    ヒント: 2つの --refresh-y フラグを渡すと強制的に(リストが最新でも) pacman の全てのパッケージリストを更新させます。新しいミラーに変更した時はいつでも pacman -Syy をするようにして下さい。無用な問題を避けることができます。

    ミラーの状態

    Arch ミラーの状態やアップデートの頻度を確認するには https://www.archlinux.org/mirrors/status/http://www.archlinux.de/?page=MirrorStatus を見て下さい。

    最新のミラーリストをここで生成することができます。ミラーリストの生成はスクリプトを使ったり、Mirrorcheck を使って生成する Reflector をインストールすることで自動化可能です。ミラーの更新状態を手動で確認するには:

    1. サーバーの "extra/os/" をブラウズ;
    2. 他のタブ・ウィンドウで https://www.archlinux.org/ にアクセス;
    3. ミラーの i686 ディレクトリの最終更新日とホームページの右の Package Repositories にある [extra] の日付を比較する。

    ミラーをソートする

    パッケージをダウンロードする際、pacman は /etc/pacman.d/mirrorlist に書かれた順番でミラーを使用します。更新頻度と速度でミラーをソートする reflector を使わない場合、以下の方法で手動でミラーをソートしてください。

    速度で並び替える

    Bash スクリプト /usr/bin/rankmirrors で最速のローカルミラーを決定することができます。

    既存の /etc/pacman.d/mirrorlist をバックアップしてください:

    # cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
    

    /etc/pacman.d/mirrorlist.backup を編集して rankmirrors でテストするミラーをアンコメントしてください。

    全てのミラーをアンコメントしたいなら以下の sed を実行:

    # sed '/^#\S/ s|#||' -i /etc/pacman.d/mirrorlist.backup
    

    最後に、ミラーにランク付けをします。-n 6 は最速の6つのミラーを出力することを意味しています:

    # rankmirrors -n 6 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist
    

    rankmirrors -h でオプションを全て一覧できます。

    速度と状態で並び替える

    最速のミラーだけを使うのはいいアイデアとは言えません。最速のミラーの更新が遅れることがありえるからです。速度で並び替えてからミラーの状態によって6つの最速のミラーをソートするのが好ましい方法です。

    Simply visit either one or both #ミラーの状態 links and sort them by the ones that are more up to date. Move the more up to date mirrors to the top of /etc/pacman.d/mirrorlist and if the mirrors are way out of date simply do not use those; repeat the process leaving out the outdated mirrors. So this ends up with a total of 6 mirrors that are sorted by speed and status, leaving out outdated mirrors.

    When having mirror issues the above should be repeated. Or repeat once in a while even if not having mirror problems, to keep /etc/pacman.d/mirrorlist up to date.

    Mirrorlist Generator からダウンロードするスクリプト

    シェルスクリプトを使うことで Pacman Mirrorlist Generator によって作られたランキングに基づいてミラーリストを作成することができます (あなたの住んでいる国が日本ではないならば、country 変数を変えてください)。次のコマンドでスクリプトをダウンロードできます: curl http://pastebin.ca/raw/2404700 -o pacmrr, (view script)。

    Reflector を使う

    Reflector を使えば、自動で MirrorStatus ページから最新のミラーリストを取得して、どのミラーが最新かフィルタリング・速度でソートして /etc/pacman.d/mirrorlist ファイルを上書きできます。

    ローカルミラーを選択する

    一番簡単な方法はリストの一番上にローカルミラーを置くようにミラーリストを編集することです。これで優先的にローカルミラーが pacman によって使われます。

    また、/etc/pacman.conf を編集してミラーリストファイルの行の前 ("add your preferred servers here" のところ) にローカルミラーを記述することもできます。各リポジトリで同じサーバーを使っている場合この方法のほうが安全です。

    公式ミラー

    公式の Arch Linux ミラーのリストは pacman-mirrorlist パッケージから入手できます。最新のミラーのリストがもっと欲しいならば、このサイトの Pacman Mirror List Generator ページを使ってください。

    ありえないケースですが、もしあなたがミラーを設定しておらず pacman-mirrorlist をインストールしていない場合は、次のコマンドを実行してください:

    # wget -O /etc/pacman.d/mirrorlist https://www.archlinux.org/mirrorlist/all/
    

    上述のとおり好ましいミラーをアンコメントして、次を実行:

    # pacman -Syy
    # pacman -S --force pacman-mirrorlist
    

    あなたのミラーを公式のリストに追加したいなら、リクエストを送って下さい。それまでは、このページの後ろにある非公式ミラーリストにミラーを加えて下さい。

    $arch 変数が定義されていないというエラーが表示されたら、/etc/pacman.conf に以下を追加してください:

    Architecture = x86_64
    
    ノート: Architecture 変数には autoi686 といった値も使うことができます。

    IPv6 対応ミラー

    pacman mirror list generator を使って最新の IPv6 ミラーのリストを見つけることができます。

    非公式ミラー

    以下のミラーは /etc/pacman.d/mirrorlist記載されていません

    グローバル

    TOR ネットワーク

    オーストリア

    ブルガリア

    中国

    CHINA TELECOM

    CHINA UNICOM

    Cernet

    フランス

    ドイツ

    インド

    インドネシア

    日本

    カザフスタン

    リトアニア

    マレーシア

    ニュージーランド

    ポーランド

    ロシア

    シンガポール

    南アフリカ

    アメリカ合衆国

    ベトナム

    FPT TELECOM

    Hyperboria

    トラブルシューティング

    Out-of-sync mirrors: 破損したパッケージ/ファイルが見つからない

    Issues regarding out-of-sync mirrors pointed out in this news post may have already been sorted out for most users, but in the event that problems of this nature present themselves again, simply try to see if the packages are present in the [testing] repository.

    After having synced with pacman -Sy, use this command:

    # pacman -Ud $(pacman -Sup | tail -n +2 | sed -e 's,/\(core\|extra\)/,/testing/,' \
                                                  -e 's,/\(community\)/,/\1-testing/,')
    

    Doing so could help in any occasion where packages in the mirror have not been synced to [core] or [extra], and are still residing in [testing]. It is perfectly safe to install from [testing] in this case since the packages are being matched by version and release numbers.

    In any event, it is best to switch mirrors and sync with pacman -Syy than resorting to an alternate repository. However, all or some of the mirrors may at times be out-of-sync to some degree.

    全てのミラーを使う

    pacman -Su を全てのミラーリストで行う挙動をエミュレートするには、以下のスクリプトを使って下さい:

    ~/bin/pacup
    #!/bin/bash
    
    # Pacman will not exit on the first error. Comment the line below to
    # try from [testing] directly.
    pacman -Su "$@" && exit
    
    while read -r pkg; do
      if pacman -Ud "$pkg"; then
        continue
      else
        while read -r mirror; do
          pacman -Ud $(sed "s,.*\(/\(community-\)*testing/os/\(i686\|x86_64\)/\),$mirror\1," <<<"$pkg") &&
          break
        done < <(sed -ne 's,^ *Server *= *\|/$repo/os/\(i686\|x86_64\).*,,gp' \
               </etc/pacman.d/mirrorlist | tail -n +2 )
      fi
    done < <(pacman -Sup | tail -n +2 | sed -e 's,/\(core\|extra\)/,/testing/,' \
                                            -e 's,/\(community\)/,/\1-testing/,')
    

    参照

    • MirUp – pacman ミラーリストのダウンローダー・チェッカー