Windows子系统安装
Enable the Windows Subsystem for Linux
Open PowerShell as Administrator and run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Enable Virtual Machine feature
Open PowerShell as Administrator and run:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Restart your machine to complete the WSL install and update to WSL 2.
Download the Linux kernel update package
- Download the latest package:
WSL2 Linux kernel update package for x64 machines - 下载完成之后双击安装即可。
Set WSL 2 as your default version
Open PowerShell and run this command to set WSL 2 as the default version when installing a new Linux distribution:
wsl --set-default-version 2
Install your Linux distribution of choice
这里有两种选择:
- 在Microsoft Store里直接搜索“Ubuntu”,安装自己想要的版本,这种方式会自动安装到C盘下。
- 如果不习惯将其安装到C盘下,可以按如下方式将其安装到指定的磁盘。这里以Ubuntu1804为例:
- 下载Ubuntu1804的wsl发行版本:
Ubuntu_1804 - 将下载的文件拷贝到想要安装wsl的目录下
- 把
***.appx
后缀改为***.zip
,并解压。 - 双击
Ubuntu1804.exe
即开始安装。
- 下载Ubuntu1804的wsl发行版本:
Shut Down and Restart Your WSL
# run the following command in cmd with Administrator rights
# shut down
net stop LxssManager
# start system
net start LxssManager
以上内容参考官方教程