How to setup WSL with GUI?
start.cmd launches WSL session and XServer simultaniously. It'll try to deduce session/windows manager to be launched.
stop.cmd stops LxssManager, which is equal to Linux subsystem shutdown.
You'll need Powershell with Administrative privileges
- Install WSL on your PC:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all
Enter 'Y' to restart your system.
For WSL2 you'll need Hyper-V:
DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V
- Install any distributive via Store or using Powershell (e.g. Ubuntu 18.04):
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile Ubuntu.appx -UseBasicParsing
After installation, you'll be able to run wsl
and bash
.
Upgrade to WSL2:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2
Install X-server for Windows (for example, VcXsrv or Xming).
choco install vcxsrv
# or
choco install xming
To connect WSL to it we should start it in background. The simpliest way to do that is to run wscript with actual Visual Basic script as argument (startup script creates it in temporary directory).
WSL has issues with x32 architecture support - you can use this solution:
sudo apt install -y qemu-user-static
sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic '\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff'
# unfortunately you should run this command @ every session start:
sudo service binfmt-support start