Use X11 Forwarding With WSL - IIHE Wiki
Use X11 Forwarding With WSL - IIHE Wiki
Contents
1 About
2 Windows 10
2.1 Pre-requities
2.2 Install Chocolatey
2.3 Install WSL1 & VCXSVR
2.4 Install your Linux distribution on WSL
2.5 Starting The distribution
3 Windows 11
3.1 Installing using WSL.exe
3.2 Starting The distribution
About
This page will help you to install Windows Subsystem for Linux and X11 forwarding on Windows 10 or Windows 11.
Windows Subsystem for Linux can run a complete Linux OS inside Windows.
VCXSVR will help you to have X11 forwarding enabled.
Starting from Windows 10 build 2004 you can install WSL2 & a Linux distribution from an elevated prompt in one
command, more info here (https://wiki.iihe.ac.be/index.php?title=Use_X11_forwarding_with_WSL#Installing_using_W
SL.exe).
Windows 10
Pre-requities
Windows 10 Windows 11.
Administrative rights on your computer.
Chocolatey, the Windows package manager installed.
Install Chocolatey
Open a Powershell shell as Administrator by pressing the following keys :
Windows key + X
Paste the following in the Powershell window :
Windows key + X
This command will install Windows Terminal, VCXSRV and enable WSL to enable X11 forwarding.
Leave the Powershell window open since we still need it to install your distribution.
Ubuntu 18.04
Ubuntu 20.04
Ubuntu 22.04
Debian GNU/Linux
Kali Linux
openSUSE 42.2 (Malachite)
SUSE Linux Enterprise Server 12 SP2
Fedora Remix for WSL
Once you choose the distribution you can download and install it in one Powershell command :
USE :
Ubuntu 20.04
Ubuntu 22.04
Debian GNU/Linux
Kali Linux
Now you have a complete Linux distribution installed on Windows 10 and X11 forwarding enabled.
Windows 11
Installing using WSL.exe
From Windows 11 & Windows 10 build 2004 and later you can install WSL2 and a Linux distribution directly from an elevated
command prompt using WSL.exe.
Note that you need an up to date Windows 11 or a Windows 10 starting from Build 2004 and the update KB5004296
installed.
WSL2 does NOT need a X11 server to be installed on Windows to enable x11 forwarding, it will work out of the box.
If you want to install Ubuntu LTS just type the following from an elevated command prompt :
wsl --install
If you you want to list available distributions use the following command :
Once you choose the distribution that you want to install use the following command :
(replace <DistributionName> with the name of the distribution you want to install eg "wsl --install -d debian".)
You have to set a username and password Note that you can't use the same username as your Windows username:
Let's update the software on the distribution (Debian or Ubuntu) :
Now you have a complete Linux distribution installed on Windows and X11 forwarding enabled trough WSL2.