Kali Linux desktop (xfce) on Windows using WSL2

I highly suggest you to install and use Windows Terminal that works with powershell, powershell core, command prompt, WSL, WSL2, …

Install WSL2 on Windows

Always check the latest Windows Subsystem for Linux Installation Guide for Windows 10

The new way

Starting from Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11, you can install wsl2 and ubuntu as default distro with just one command!!

wsl --install

The old way

  1. Open PowerShell as Administrator and run

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

  2. Now restart and update windows to get WSL2

    • Running Windows 10, updated to version 1903 or higher, Build 18362 or higher for x64 systems.
    • Running Windows 10, updated to version 2004 or higher, build 19041, for ARM64 systems.
    • Please note if you are on Windows 10 version 1903 or 1909 you will need to ensure that you have the proper backport, instructions can be found here.
    • Check your Windows version by selecting the Windows logo key + R, type winver, select OK. (Or enter the ver command in Windows Command Prompt). Please update to the latest Windows version if your build is lower than 18361. Get Windows Update Assistant.

  3. Enable the ‘Virtual Machine Platform’ optional component

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

  4. Install WSL2 Linux kernel update


  5. Restart and set WSL2 as your default version

    wsl –set-default-version 2

    If you see a message like WSL 2 requires an update to its kernel component follow this link https://aka.ms/wsl2kernel and install the MSI from that page.

Install Kali Linux

  1. Install Kali Linux from Microsoft Store
  2. Run Kali Linux from start menu and configure it as requested
  3. Open again Kali Linux and install the desktop using win-kex
    1. sudo apt update && sudo apt full-upgrade -y
    2. sudo apt install kali-win-kex -y
  4. Now run kex and you’re ready to go
    • kex (run a desktop and leave it running until you stop it)
    • kex stop (to stop the current desktop)
    • kex wtstart (to run a desktop connected to a windows terminal tab, when you close the tab the desktop will be killed, when you close the desktop, you can re-open it or kill)
  5. If you want a lot of more tool you can install the large edition of kali
    • sudo apt install kali-linux-large

Move Kali to Different Hard Disk Drive

  1. wsl –terminate kali-linux
  2. wsl –export kali-linux “D:\kali-linux.tar”
  3. wsl –unregister kali-linux
  4. uninstall Kali Linux from start menu, right click, uninstall
  5. wsl –import kali-linux “D:\wsl\kali-linux” “D:\kali-linux.tar”
  6. wsl –set-default kali-linux
  7. open a terminal on kali
    wsl -d kali-linux
  8. restores default user, creating this config file
    sudo nano /etc/wsl.conf
  9. add the username you have configured the first time you installed kali linux before exporting it
  10. close the terminal
  11. wsl –terminate kali-linux
  12. reopen the terminal