Run the Kali-Linux GUI in WSL2 with only two lines of code

Microsoft has added graphics support to Windows WSL2 by adding a new graphical component called WSLg. The thing rocks but Linux can be fiddly for setting up what is essentially a remote desktop.  It turns out that the Kali team created a single package that handles everything, kali-win-kex. Just install kali-win-kex and run it.



Upgrade WSL to support GUI integration

Update your WSL to make sure WSLg is installed and is on the latest version. This code exists in themove-distribution.ps1 script

wsl --update

Install kali-win-kex

Option 1: Enable kali-win-kex and run the Kali GUI without any upgrades

From the Kali-Linux shell prompt

# install the Kali remote destop server
sudo apt update
sudo apt install -y kali-win-kex
# start the Kali remote desktop with Windows integration

Option 2: Run updates, install all packages, enable kali-win-kex, run the Kali GUI

Install package kali-win-kex and add remote desktop access to the Linux GUI with a single updated component.

Update and upgrade kali-linux and install the kali-win-kex to support running the GUI in WSL. Bulk up this kali-linux with a bunch of other packages from kali-linux-large.

# install kex
sudo apt update
sudo apt upgrade
sudo apt install -y kali-win-kex
# Jack up the install to everything
sudo apt install -y kali-linux-large

Launching the desktop

Launch the WSL2 Kali desktop from a Linux terminal window.  It will run full screen on the current monitor. Execute _as you_ from a Linux command line to bring up the Linux GUI

kex --win -s

Launch the WSL2 Kali desktop from Windows to bring up the Linux GUI

wsl -d kali-linux kex --win -s


2022 06


Popular posts from this blog

Understanding your WSL2 RAM and swap - Changing the default 50%-25%

Installing the RNDIS driver on Windows 11 to use USB Raspberry Pi as network attached

DNS for Azure Point to Site (P2S) VPN - getting the internal IPs