Kali Linux GUI installation on Windows Subsystem for Linux

By now, with the Windows Subsystem for Linux 2 and using kali Linux, it becomes possible now to spawn a graphic desktop environment that is shown directly within Windows.

Windows Subsystem for Linux provides compatibility layer for running Linux binary executables natively on Windows 10 and Windows servers. When it was first released, it utilized a Linux-compatible kernel that translated the Linux system calls into system calls that can be executed by Windows kernel.

With the release of Windows System for Linux 2, a real kernel runs on the top of the Microsoft’s Hyper-V virtualization architecture. It provides native compatibility and performance benefits. In addition to this, it allows launching of Windows executables directly within the WSL Linux distribution. This feature allows the kali Linux to create a package named “Win-Kex” that spawns a Windows VNC client connected to an Xfce graphical desktop environment running within WSL.

To get started with Win-Kex, you need to install the Windows Subsystem for Linux (on Windows 10 version 2004). After WSL installed, install Kali Linux and launch it and run the following commands:

 sudo apt update

sudo apt dist-upgrade

This will prep the distribution with the latest updates and required files. Upon that, install Win-Kex package using the following commands:

sudo apt install -y kali-win-kex

Wait for the process to be completed (you require patience here as the above commands will install many packages). After this is done, enter the following code and install kali-Linux tools:

sudo apt install -y kali-linux-default

Once again, you need to have patience as this command will also install many packages.

When the system gets prepped, you will have a new kex command to use to gain access to the Kali Linux GUI desktop. To do this, Win-Kex launches a VNCServer with the Xfce desktop environment within the Kali Linux WSL instance. After this, it starts the TigerVNC windows client and automatically passes the commands to connect to the VNC server.

You just need to enter Kex to launch the VNCServer and connect to it via TigerVNC that allow the kali Linux Desktop to automatically start in Windows. After that, you will have the GUI desktop running windows and so can do whatever research and test you want to do.