rem 这行貌似没用
wsl --install
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
rem 不启用hyperV
rem dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
rem dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /norestart
wget https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
wsl_update_x64.msi rem 安装后即为 WSL 2 ?
wsl --set-default-version 2
wget https://wsldownload.azureedge.net/Ubuntu_2004.2020.424.0_x64.appx
rem 解压 Ubuntu_2004.2020.424.0_x64.appx 到D:\Ubuntu_2004.2020.424.0_x64\
D:\Ubuntu_2004.2020.424.0_x64\ubuntu2004.exe REM 此即开始安装 Ubuntu20.04
rem 安装完后:
D:\Ubuntu_2004.2020.424.0_x64\ubuntu2004.exe rem 即打开 ubuntu20.04的 shell
wsl2 gui
wsl2 :
sudo apt-get install x11-apps
sudo apt-get install xfce4-terminal
sudo apt-get install xfce4
安装 VcXsrv , 启动 XLaunch,
Display number : 0
Disable access control
Additioanl parameters for VcXsrv: -ac
执行 “启动x”
以下内容写入到 .bashrc中,
#启动x:
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0.0
export LIBGL_ALWAYS_INDIRECT=1
pidof xfce4-session || ( nohup startxfce4 & )
以后日常启动过程
- cmd下执行: wsl --shutdown
- 启动 XLaunch
- 启动x (打开wsl终端即可)