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?

More than 3 years have passed since last update.

Win10 1909 でも WSL2 を使いたい!

Posted at

Windows 10 1903/1909 でも WSL2 が使えるようになったとのことで、Docker Desktop を使ってる身としては早いところ Hyper-V から WSL2 に乗り換えたい…というわけで、乗り換え手順のメモ。

※もう似たような記事がたくさん出てますが(滝汗; …まぁ自分用ということで。

1. WSL 機能を有効化します。

PowerShell プロンプトを管理者モードで開いて、下記の2コマンドを打ちます。

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

実行し終わったら再起動します。

Restart-Computer

2. (環境によっては必須) KB4566116 を適用します。

個人の開発環境なら WindowsUpdate も最新状態でしょうからたぶん適用済みでしょうが、会社の環境で WSUS で統制されていたりすると必ずしも適用されません。このパッチを適用しておかないと手順 4. で実行する wsl --set-default-version 2 が「コマンド ライン オプションが無効です」と怒られるので、未適用の場合は上記リンクから自分の環境用に適切なものをダウンロードして適用します(実行完了まで数時間かかる場合があります)。実行完了すると再起動を求められるので、素直に再起動します。

3. WSL2 Linux kernel を更新します。

最新版の WSL2 Linux カーネル をダウンロードしてインストールします。

4. WSL のバージョンをセットします。

PowerShell プロンプトを管理者モードで開いて、下記のコマンドを打ちます。

wsl --set-default-version 2

5. (オプション?) Microsoft ストアからお好きな Linux ディストリビューションを入手します。

Ubuntu でも Debian でも。

6. (オプション?) Docker Desktop を使ってる人は WS2 integration を有効化しましょう。

image.png

画面右下の Apply & Restart ボタンを押して、完了!

参考: https://cybergav.in/2020/08/28/wsl2-on-windows-10/

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?