不能在WSL中直接运行Ubuntu或Kali Linux,但可以使用WSL2。要使用WSL2,请打开Windows功能,并启用“虚拟机平台”和“Windows子系统的Linux”,然后根据需要安装Ubuntu或Kali Linux:
打开PowerShell并运行以下命令以启用虚拟化功能:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
下载并安装WSL2 Linux内核更新包:
https://aka.ms/wsl2kernel 启用WSL2:
wsl --set-default-version 2
从Microsoft Store安装Ubuntu或Kali Linux。
代码示例:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2
参考链接: https://docs.microsoft.com/en-us/windows/wsl/install-win10#step-4---download-the-linux-kernel-update-package https://docs.microsoft.com/en-us/windows/wsl/wsl2-install https://docs.microsoft.com/en-us/windows/wsl/install-win10#step-5---install-your-linux-distribution-of-choice