WSL2 安装和卸载

38,825 阅读1分钟

WSL2 安装和卸载

安装

启用 wsl

  • 命令行
# 启用 wsl
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
# 启用虚拟机
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# 设置 wsl 默认版本
wsl --set-default-version 2
  • 设置

从 Microsoft Store 获取 Ubuntu

启动

输入新用户名/密码

cmd 进入 wsl

bash

卸载

  • 查看安装的系统
wsl --list

  • 卸载对应的系统
wsl --unregister Ubuntu

  • 卸载验证
wsl --list