Setting Up Kali Linux with GUI on Windows Subsystem for Linux (WSL2)

Setting Up Kali Linux with GUI on Windows Subsystem for Linux (WSL2)

·

3 min read

If you're looking to set up Kali Linux with a full graphical user interface (GUI) on your Windows machine, the Windows Subsystem for Linux (WSL2) provides a powerful and efficient way to do so. In this guide, we'll walk through the process step-by-step, enabling you to have Kali Linux up and running with a GUI in no time.

Step 1: Enabling WSL

The first step is to enable the Windows Subsystem for Linux (WSL) on your system. Open PowerShell with administrative privileges and run the following command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

This command enables the WSL feature on your Windows system.

Step 2: Enabling the Virtual Machine Feature

For WSL2 to function correctly, the Virtual Machine Platform feature needs to be enabled. After completing Step 1, restart your computer. Once the system has rebooted, open PowerShell again with administrative privileges and execute the following command:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

This command ensures that your system can run virtual machines, which is essential for WSL2.

Step 3: Setting Up WSL

Next, you'll need to configure the WSL feature itself. Run the following command in PowerShell with administrative privileges:

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

This command prepares your system for running Linux distributions via WSL.

Step 4: Downloading and Installing the Linux Kernel

After setting up WSL, you'll need to download and install the Linux kernel. Restart your computer again. Once it's back up, download the Linux kernel from the official Microsoft link. After downloading, install the WSL2 kernel by following the provided instructions. https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package

Step 5: Setting WSL2 as the Default Version

To ensure that all future Linux distributions you install use WSL2, you'll need to set it as the default version. Run the following command in PowerShell with administrative privileges:

wsl --set-default-version 2

This command configures WSL2 as the default version for your system.

Step 6: Downloading Kali Linux from the Microsoft Store

Now that WSL2 is configured, you can download Kali Linux from the Microsoft Store. Follow this link to the store page, and install Kali Linux on your system.

Step 7: Installing the GUI for Kali Linux

With Kali Linux installed, it's time to set up the graphical user interface (GUI). Open the Kali Linux terminal and run the following commands:

sudo apt install kali-desktop-xfce -y
sudo apt install xrdp -y
sudo service xrdp start

These commands install the XFCE desktop environment and the XRDP server, which allows you to access the GUI via Remote Desktop.

Step 8: Connecting via Remote Desktop

Finally, to access the Kali Linux GUI, open the Remote Desktop Connection on your Windows machine. Enter the IP address of your WSL2 instance to connect.

And that's it! You've successfully set up Kali Linux with a GUI on WSL2. Enjoy your fully functional Linux environment right within your Windows operating system!