0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WSLで同バージョンのディストリビューション作成

Last updated at Posted at 2025-03-28

背景

WSLのUbuntuを開発環境として使用していた。
Ubuntuの設定に依存する機構があり、まっさらなUbuntuで動作確認をしたいとなった時に、既存の環境を残したまま、新しく同バージョンのUbuntuをWSLとしてインストールしたくなった。
現在の環境を複製(エクスポートして別名でインポート)する方法は、検索してすぐに見つかったが、まっさらな環境をインストールする方法はすぐに分からなかったのメモしておく。

前提環境

  • Windows 11 Pro
  • WSL バージョン: 2.4.13.0
  • インストール済みのWSLディストリビューション
    image.png

インストール

既にインストール済みのUbuntu-24.04とは別に、もう一つUbuntu-24.04を追加インストールする。

コマンド

wsl --install Ubuntu-24.04 --name Ubuntu-24.04-20250328

コマンド内容

wsl --install <取得するディストリビューション名> --name <ローカル環境のディストリビューション名>

ローカル環境のディストリビューション名

既存の名称を指定すると下記のエラーになる。

指定された名前のディストリビューションは既に存在します。--name を使用して別の名前を選択してください。
エラー コード: Wsl/InstallDistro/Service/RegisterDistro/ERROR_ALREADY_EXISTS

実行結果

無事に追加されました。
image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?