CasperG's Blog

Some People choose to see the ugliness in the world, the disarray. I choose to see the beauty.

在Windows10下利用wsl2运行Ubuntu的解决方案

在Windows10下利用WSL2运行Ubuntu的解决方案


WSL2是微软自带的一款超优秀的linux虚拟机,借助WSL2,可以在Win10中创建一个linux发行版子系统

前置需求:

Win10最新版本

管理员模式下的PowerShell或命令提示符

安装步骤:

  1. 在PowerShell中运行以下命令以安装WSL2:

    1
    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  2. 启用虚拟机平台

    1
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

    重启计算机以完成安装

  3. 安装Linux内核更新包(备份在OneDrive中)

适用于x64的WSL2 Linux内核更新包

  1. 将WSL2设置为默认版本
1
wsl --set-default-version 2
  1. 安装Linux发行版

    在Microsoft Store中搜索Ubuntu并安装

    企业微信截图_16206569018073.png

  2. 启动软件,Ubuntu将自动安装

使用:

在PowerShell或命令提示符中输入wsl以启动Ubuntu.