使用 WSL 在 Windows 上安装 Linux
之前一直是使用 VMWare 构建 linux 虚拟系统,但是深觉麻烦,最近查询到可以直接使用 WSL 在 Windows 上安装 Linux,遂记录。
按照教程,首先安装 WSL 命令
在PowerShell,输入 wsl --install 命令,但是在最后一步安装 Ubuntu 时一直报错
PS C:\WINDOWS\system32> wsl --install
正在下载: Ubuntu
正在安装: Ubuntu
由于未安装所需的特性,无法启动操作。
错误代码: Wsl/InstallDistro/Service/RegisterDistro/CreateVm/HCS/HCS_E_SERVICE_NOT_AVAILABLE
经过查询后发现是“虚拟机平台”功能被禁用,根据教程
在PowerShell,输入 Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -All 命令,重新启动计算机后,重新运行 wsl --install ,
PS C:\WINDOWS\system32> wsl --install
正在下载: Ubuntu
正在安装: Ubuntu
已成功安装分发。可以通过 “wsl.exe -d Ubuntu” 启动它
正在启动 Ubuntu...
Provisioning the new WSL instance Ubuntu
This might take a while...
Create a default Unix user account:
成功出现设置 Linux 用户名和密码的命令行并且自动弹出以下页面,证明使用 WSL 安装 Linux 发行版的过程完成。

进入下一步,设置 Linux 用户信息:
PS C:\WINDOWS\system32> wsl --install
正在下载: Ubuntu
正在安装: Ubuntu
已成功安装分发。可以通过 “wsl.exe -d Ubuntu” 启动它
正在启动 Ubuntu...
Provisioning the new WSL instance Ubuntu
This might take a while...
Create a default Unix user account: hjz
New password:
Retype new password:
passwd: password updated successfully
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
hjz@LAPTOP-7RB4IPJS:/mnt/c/WINDOWS/system32$
通过设置用户名和密码之后,我们便进入到了Ubuntu 的子系统环境。值得注意的是输入密码的时候屏幕上不会显示任何内容。,这称为盲人键入。 你不会看到你正在键入的内容,这是完全正常的。
君子坦荡荡,也要常嘻嘻呀!

浙公网安备 33010602011771号