Hyper-VのNested VMにWindows Server 2022 Dockerを使えるようWSL2をインストール

Windows Server

ホストマシンにて仮想マシンにさらにHyper-Vを作成できる設定を行う。

PS C:\> Get-VMProcessor -VMName * |ft VMName,ExposeVirtualizationExtensions
VMName                      ExposeVirtualizationExtensions
------                      ------------------------------
Windows Server 2022 Jp                             False
PS C:\> Set-VMProcessor -VMName "Windows Server 2022 Jp" -ExposeVirtualizationExtensions $true
PS C:\> Get-VMProcessor -VMName * |ft VMName,ExposeVirtualizationExtensions
VMName                      ExposeVirtualizationExtensions
------                      ------------------------------
Windows Server 2022 Jp                              True

VirtualMachinePlatform 有効化

PS C:\> Enable-WindowsOptionalFeature -online -FeatureName VirtualMachinePlatform
この操作を完了するために、今すぐコンピューターを再起動しますか?                                                         [Y] Yes  [N] No  [?] ヘルプ (既定値は "Y"): N
Path          :
Online        : True
RestartNeeded : True

PS C:\> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
この操作を完了するために、今すぐコンピューターを再起動しますか?
[Y] Yes  [N] No  [?] ヘルプ (既定値は "Y"): Y
Path          :
Online        : True
RestartNeeded : True
PS C:\> wsl --update
ダウンロード中: Linux 用 Windows サブシステム
インストール中: Linux 用 Windows サブシステム
Linux 用 Windows サブシステム  はインストールされました。

PS C:\> wsl --status
既定のバージョン: 2

PS C:\> wsl -l -o
インストールできる有効なディストリビューションの一覧を次に示します。
'wsl.exe --install <Distro>' を使用してインストールします。
NAME                                   FRIENDLY NAME
Ubuntu                                 Ubuntu
Debian                                 Debian GNU/Linux
kali-linux                             Kali Linux Rolling
Ubuntu-18.04                           Ubuntu 18.04 LTS
Ubuntu-20.04                           Ubuntu 20.04 LTS
Ubuntu-22.04                           Ubuntu 22.04 LTS
Ubuntu-24.04                           Ubuntu 24.04 LTS
OracleLinux_7_9                        Oracle Linux 7.9
OracleLinux_8_7                        Oracle Linux 8.7
OracleLinux_9_1                        Oracle Linux 9.1
openSUSE-Leap-15.5                     openSUSE Leap 15.5
SUSE-Linux-Enterprise-Server-15-SP4    SUSE Linux Enterprise Server 15 SP4
SUSE-Linux-Enterprise-15-SP5           SUSE Linux Enterprise 15 SP5
openSUSE-Tumbleweed                    openSUSE Tumbleweed

PS C:\> wsl --install -d Ubuntu-24.04
ダウンロード中: Ubuntu 24.04 LTS
インストール中: Ubuntu 24.04 LTS
Ubuntu 24.04 LTS がインストールされました。
Ubuntu 24.04 LTS を起動しています...
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: sadarisystem
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 24.04 LTS (GNU/Linux 5.15.146.1-microsoft-standard-WSL2 x86_64)
 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro
 System information as of Sat Apr 27 05:45:48 JST 2024
  System load:  0.38                Processes:             55
  Usage of /:   0.1% of 1006.85GB   Users logged in:       0
  Memory usage: 9%                  IPv4 address for eth0: 172.30.32.208
  Swap usage:   0%
This message is shown once a day. To disable it please create the
/home/sadarisystem/.hushlogin file.
sadarisystem@S-WIN22-221:~$

タイトルとURLをコピーしました