WSL2 ubuntu 24.04のアーカイブミラーサーバーを変更する

変更理由

ネットワーク設定を変更していないにも拘らず,apt でのsecurity.ubuntu.com, archives.ubuntu.com等の公式サーバーへアクセスが出来なくなった.
ipv6 の無効化やファイアウォールの確認などを行ったが,改善しなかった.

ミラーサーバーへ変更

ubuntu 24.04から apt リポジトリの設定は/etc/apt/sources.listではなく,/etc/apt/sources.list.d/ubuntu.sourcesで行う.
今回は最も速いICSCoEに変更します.

WARNING

書き換える前に必ず,バックアップを取ってください.

  • /etc/apt/sources.list.d/ubuntu.sources
## See the sources.list(5) manual page for further settings.
Types: deb
URIs: [このURLを書き換える]
Suites: noble noble-updates noble-backports
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

## Ubuntu security updates. Aside from URIs and Suites,
## this should mirror your choices in the previous section.
Types: deb
URIs: [このURLを書き換える]
Suites: noble-security
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

これを適用すると,正常に apt が使用できるようになります.