Skip to content

Install WSL2 on Windows10

Check current Windows environment

Check Version

Win + r

winver

Check storage size

setting > system > memory(記憶域) check enough storage syze(over 10 GB)

Widows update

Get windows update manually https://www.microsoft.com/ja-jp/software-download/windows10 Click “Update now” Download windows update assistant and execute it.

On 24 Jan 2021, the latest version is “20H2”

Need to wait update completion .. for a long time Then finally,

Activate

Activate WSL

Run powershell by administrator authorization Windows > Windows Powershell > (right click) 管理者権限で実行

Activate Windows Subsystem Linux by

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
PS C:\WINDOWS\system32> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

展開イメージのサービスと管理ツール
バージョン: 10.0.19041.746

イメージのバージョン: 10.0.19042.746

機能を有効にしています
[==========================100.0%==========================]
操作は正常に完了しました。

Enable Virtual Machine Platform

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart PS C:\WINDOWS\system32> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

1
2
3
4
5
6
7
8
展開イメージのサービスと管理ツール
バージョン: 10.0.19041.746

イメージのバージョン: 10.0.19042.746

機能を有効にしています
[==========================100.0%==========================]
操作は正常に完了しました。

Restart Windows

Set WSL2 as a default version of wsl

Command prompt or windows powershell

wsl --set-default-version 2

If you see below warning messages, then follow instruction here

PS C:\WINDOWS\system32> wsl --set-default-version 2

1
2
WSL 2 を実行するには、カーネル コンポーネントの更新が必要です。詳細については https://aka.ms/wsl2kernel を参照してください
WSL 2 との主な違いについては、https://aka.ms/wsl2 を参照してください

Then, ##download x64 マシン用 WSL2 Linux カーネル更新プログラム パッケージ## then install it

then activate again.

1
2
PS C:\> wsl --set-default-version 2
WSL 2 との主な違いについては、https://aka.ms/wsl2 を参照してください

(This is OK)

Install Ubuntu on WSL2

Get ubuntu 20.04 LTS at Microsoft Store

https://www.microsoft.com/ja-jp/p/ubuntu-2004-lts/9n6svws3rx71?rtc=1&activetab=pivot:overviewtab

Get > Install > Launch

After installation process, asked to enter user name and passord.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: tato
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.72-microsoft-standard-WSL2 x86_64)

* Documentation:  https://help.ubuntu.com
* Management:     https://landscape.canonical.com
* Support:        https://ubuntu.com/advantage

  System information as of Mon Jan 25 00:59:25 JST 2021

  System load:  0.11               Processes:             8
  Usage of /:   0.4% of 250.98GB   Users logged in:       0
  Memory usage: 1%                 IPv4 address for eth0: 172.28.129.129
  Swap usage:   0%

1 update can be installed immediately.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable


The list of available updates is more than a week old.
To check for new updates run: sudo apt update


This message is shown once once a day. To disable it please create the
/home/tato/.hushlogin file.

Update Ubuntu

tato@greenlantern:~$

1
2
$ sudo apt update
$ sudo apt upgrade

Check wsl version on Windows Powershell

1
2
3
4
5
6
7
PS C:\WINDOWS\system32> wsl --list --verbose
  NAME            STATE           VERSION
* Ubuntu-20.04    Running         2

PS C:\WINDOWS\system32> wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-20.04    Running         2

Ref. Win10にWSL2とUbuntu 20.04をインストールする https://astherier.com/blog/2020/07/install-wsl2-on-windows-10-may-2020/


Last update: January 29, 2021