
Ubuntuリポジトリのミラーサーバーを変更した
- 日本語
- Linux Mint
- Ubuntu
原因
Linux Mint導入当初、筑波大学の http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu を利用していたが、サーバーの調子が悪そうだったので変更することにしました。
今の状況はこちらです。
sudo apt update
[sudo] user のパスワード:
ヒット:1 https://cli.github.com/packages stable InRelease
ヒット:2 https://download.docker.com/linux/ubuntu noble InRelease
無視:3 https://ftp.udx.icscoe.jp/Linux/linuxmint/packages xia InRelease
ヒット:4 https://ftp.udx.icscoe.jp/Linux/linuxmint/packages xia Release
ヒット:5 https://dl.google.com/linux/chrome/deb stable InRelease
ヒット:7 http://security.ubuntu.com/ubuntu noble-security InRelease
取得:8 https://apt.fury.io/wez * InRelease
無視:9 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble InRelease
無視:10 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble-updates InRelease
無視:11 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble-backports InRelease
無視:9 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble InRelease
無視:10 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble-updates InRelease
無視:11 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble-backports InRelease
無視:9 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble InRelease
無視:10 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble-updates InRelease
無視:11 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble-backports InRelease
エラー:9 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble InRelease
'ftp.tsukuba.wide.ad.jp' を解決できませんでした
エラー:10 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble-updates InRelease
'ftp.tsukuba.wide.ad.jp' を解決できませんでした
エラー:11 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble-backports InRelease
'ftp.tsukuba.wide.ad.jp' を解決できませんでした
5,721 B を 2分 40秒 で取得しました (35 B/s)
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
状態情報を読み取っています... 完了
パッケージはすべて最新です。
W: http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu/dists/noble/InRelease の取得に失敗しました 'ftp.tsukuba.wide.ad.jp' を解決できませんでした
W: http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu/dists/noble-updates/InRelease の取得に失敗しました 'ftp.tsukuba.wide.ad.jp' を解決できませんでした
W: http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu/dists/noble-backports/InRelease の取得に失敗しました 'ftp.tsukuba.wide.ad.jp' を解決できませんでした
W: いくつかのインデックスファイルのダウンロードに失敗しました。これらは無視されるか、古いものが代わりに使われます。
設定を確認
ミラーサーバーを設定している /etc/apt/sources.list.d/official-package-repositories.list を確認します。
nvim /etc/apt/sources.list.d/official-package-repositories.list
お使いのテキストエディタで確認してください。私はNeovimを利用しているため nvim コマンドを利用しています。
deb https://ftp.udx.icscoe.jp/Linux/linuxmint/packages xia main upstream import backport
deb http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble main restricted universe multiverse
deb http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble-updates main restricted universe multiverse
deb http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu noble-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
Ubuntuのミラーサーバーを確認
ミラーサーバー一覧を確認して、筑波大学以外のサーバーを確認しました。
https://launchpad.net/ubuntu/+archivemirrors
余談ですが、Linux Mintのミラーサーバーはこちらです。
https://linuxmint.com/mirrors.php
バックアップ
間違える可能性があるため、現在のファイルをバックアップしておきます。
sudo cp /etc/apt/sources.list.d/official-package-repositories.list /etc/apt/sources.list.d/official-package-repositories.list.bak
サーバー名を置換
既存の http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu から http://ftp.jaist.ac.jp/pub/Linux/ubuntu へ置換します。
sudo sed -i 's|http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu|http://ftp.jaist.ac.jp/pub/Linux/ubuntu|g' /etc/apt/sources.list.d/official-package-repositories.list
置換が成功しているか確認
正しく置換出来ているのか確認します。
nvim /etc/apt/sources.list.d/official-package-repositories.list
以下の内容になっていました。
deb https://ftp.udx.icscoe.jp/Linux/linuxmint/packages xia main upstream import backport
deb http://ftp.jaist.ac.jp/pub/Linux/ubuntu noble main restricted universe multiverse
deb http://ftp.jaist.ac.jp/pub/Linux/ubuntu noble-updates main restricted universe multiverse
deb http://ftp.jaist.ac.jp/pub/Linux/ubuntu noble-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
動作確認
ミラーサーバーからパッケージの取得が出来るか確認します。
sudo apt update
http://ftp.jaist.ac.jp/pub/Linux/ubuntu を利用するようになっていました。
sudo apt update
ヒット:1 http://ftp.jaist.ac.jp/pub/Linux/ubuntu noble InRelease
ヒット:2 https://cli.github.com/packages stable InRelease
ヒット:3 http://ftp.jaist.ac.jp/pub/Linux/ubuntu noble-updates InRelease
ヒット:4 https://download.docker.com/linux/ubuntu noble InRelease
ヒット:5 http://ftp.jaist.ac.jp/pub/Linux/ubuntu noble-backports InRelease
無視:6 https://ftp.udx.icscoe.jp/Linux/linuxmint/packages xia InRelease
ヒット:7 https://ftp.udx.icscoe.jp/Linux/linuxmint/packages xia Release
ヒット:8 https://dl.google.com/linux/chrome/deb stable InRelease
ヒット:9 http://security.ubuntu.com/ubuntu noble-security InRelease
取得:11 https://apt.fury.io/wez * InRelease
5,721 B を 1秒 で取得しました (5,837 B/s)
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
状態情報を読み取っています... 完了
パッケージはすべて最新です。
無事にミラーサーバーの変更を行うことが出来ました!
Linux Mintのサーバーは問題無かったため変更していませんが、 /etc/apt/sources.list.d/official-package-repositories.list の deb https://ftp.udx.icscoe.jp/Linux/linuxmint/packages xia main upstream import backport を変更すれば出来そうですね。(※今回はやっていません。)
急に sudo apt update 出来なくなると心配になるので無事に解決出来て良かったです。