Build a Kali Linux environment with WSL2! We also introduce how to operate the GUI using Win-KeX!

Build a Kali Linux environment with WSL2! We also introduce how to operate the GUI using Win-KeX!

Until now, I was using Kali Linux with VirtualBox, but I was thinking that I could do it with WSL2, but it seemed to be pretty good, so I'll show you how to build it. (It's pretty easy.)

We also use Win-KeX to use the GUI.
Win-KeX makes the Kali Linux GUI easy to use with WSL2 with the following features:

  • Window Mode: Start the Kali Linux desktop with a dedicated window
  • Seamless Mode: Sharing Windows Desktop between Windows and Kali Applications and Menu
  • Enhanced Session Mode: Like Hyper-V, use RDP for a more feature-rich experience
  • Sound Support
  • Shared clipboard for cutting and paste support between Kali Linux and Windows
  • Support for root and unprivileged sessions
  • Multi-session support: Supports root windows, unprivileged windows, and seamless sessions simultaneously
  • Fully compatible with WSLg
Recommended reference books
Author: IPUSIRON
¥2,090 (As of 15:33 on 2025/07/13 | Amazon research)
\Amazon Prime Day is now underway! /
Amazon
Author: IPUSIRON
¥3,850 (As of 21:11 on 07/08/2025 | Amazon research)
\Amazon Prime Day is now underway! /
Amazon
Author: Justin Seitz, Author: Tim Arnold, Supervised by: Mantani Nobutaka, Translation: Arai Yu, Translation: Kakara Hirosei, Translation: Murakami Ryo
¥3,520 (As of 12:26 on 07/09/2025 | Amazon research)
\Amazon Prime Day is now underway! /
Amazon
table of contents

Make WSL2 available

First, make sure you have WSL2 available.
If you've already used WSL2 to a great extent, you don't need it.

Enabling Windows features

First, enable Windows features.
Open Power Shell with administrator privileges and run the following command:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all

Once it's finished running, restart it. (Make sure to do it)

Installing Windows Subsystem for Linux

Next, install Windows Subsystem for Linux.

If you launch the Microsoft Store and search for "WSL", you will see the following app called "Windows Subsystem for Linux" so please install it.

Changing the WSL2 settings

Just to be safe, I have changed the default version of wsl to 2.

PS C:\WINDOWS\system32> wsl --set-default-version 2 For the main differences with WSL 2, see https://aka.ms/wsl2 This operation has been completed correctly.

Making Kali Linux workable with CUI

Install Kali Linux

Next time I will use the Microsoft Store.

Search for Kali Linux and install the following:

Start Kali Linux

Once you've done this, try starting Kali Linux.
You will be asked to enter your username and password, so please enter it as desired.

PS C:\WINDOWS\system32> kali Installing, this may take a few minutes... Please create a default UNIX user account. The username does not need to match your Windows username. For more information visit: https://aka.ms/wslusers Enter new UNIX username: [Username] New password:[Password] Retype new password:[Password (re-enter)] passwd: password updated successfully Installation successful! ┏━(Message from Kali developers) ┃ ┃ This is a minimal installation of Kali Linux, you likely ┃ want to install supplementary tools. Learn how: ┃ ⇒ https://www.kali.org/docs/troubleshooting/common-minimum-setup/ ┃ ┗━(Run: “touch ~/.hushlogin” to hide this message) ┌──(****㉿DESKTOP-O3RMU7H)-[~] └─$

This is how I've completed the process to the point where I can operate Kali Linux using the CUI.

Making Kali Linux workable via GUI

Next, we will use Win-KeX to enable Kali Linux to operate using the GUI.
First, log in to Kali Linux using kali.

PS C:\WINDOWS\system32> kali ┏━(Message from Kali developers) ┃ ┃ This is a minimal installation of Kali Linux, you likely ┃ want to install supplementary tools. Learn how: ┃ ⇒ https://www.kali.org/docs/troubleshooting/common-minimum-setup/ ┃ ┗━(Run: “touch ~/.hushlogin” to hide this message) ┌──(****㉿DESKTOP-O3RMU7H)-[~] └─$

Install kali-win-kex

Run the following command to install "kali-win-kex".

┌──(****㉿DESKTOP-O3RMU7H)-[~] └─$ sudo apt update ┌──(****㉿DESKTOP-O3RMU7H)-[~] └─$ sudo apt install -y kali-win-kex

Try operating the GUI with Win-KeX

Just installing kali-win-kex should allow you to operate the GUI, so let's take a look.
Win-KeX has three modes: It can also be run in Kali Linux, as well as in Power Shell on Windows.

  • Window Mode (TigerVNC)
    Internal to Kali WSL: kex –win -s
    Power Shell on Windows: wsl -d kali-linux kex –win -s
  • Extended Session Mode (RDP)
    Internal to Kali WSL: kex –esm –ip -s
    Power Shell on Windows: wsl -d kali-linux kex –esm –ip -s
  • Seamless Mode (VcXsrv)
    Internal to Kali WSL: kex –sl –s
    Power Shell on Windows: wsl –d kali-linux kex –sl –s

I often use window mode, so I'll just introduce some examples of starting up in window mode and end here.
Run the following command inside Kali Linux. At this time, you will be asked for your password, so set it as desired.

┌──(****㉿DESKTOP-O3RMU7H)-[~] └─$ kex --win -s

I think Kali Linux will be displayed in full screen. (F8 allows you to unlock full screen.)

summary

This completes the method of using WSL2 to operate Kali Linux with the GUI.
Try using it for penetration tests etc.

Finally, you can install the tools used on Kali Linux all at once using the command below.
It's best to install it if necessary.

┌──(hack_lab㉿DESKTOP-O3RMU7H)-[~] └─$ sudo apt install -y kali-linux-large
Share if you like!

Who wrote this article

This is a blog I started to study information security. As a new employee, I would be happy if you could look with a broad heart.
There is also Teech Lab, which is an opportunity to study programming fun, so if you are interested in software development, be sure to take a look!

table of contents