guides software

Setting up Kali-Kex on Ubuntu on WSL

I like to use Windows Subsystem for Linux. It makes running Linux applications on Windows very easy and efficient. It runs natively, instead of emulated, and makes a workflow maintainable, including compiling Linux binaries for C and C++ applications using compilers such as GCC and Clang without needing to use simulator tools such as Cygwin and MinGW

I prefer the Ubuntu builds. It was the first Linux distribution to initially work with WSL.

With WSL 2.0 we have the ability to run graphical applications. We can use WSLg to run Windows containing individual applications within our regular interface.

However, Kali Linux’s distro has an alternative option, known as Kex. Kex allows us to have a full desktop workspace within the WSL environment with the XFCE desktop, as opposed to Ubuntu’s GNOME, which is not supported by Kex.

Since both Kali and Ubuntu are Debian-based distros, this means that the XFCE desktop and Kex can run functionally on either if installed correctly. My preference is to install Kex on Ubuntu.

These steps assume that WSL 2 is enabled and Ubuntu is installed from the Windows store and configured.

  1. Set up the Kali Keyring. This allows us to pull from Kali’s repository. The latest version can be installed in the Bash shell with this command:
    • wget
    • sudo dpkg -i kali-archive-keyring_2022.1_all.deb
  2. Add the Kali public archive key
    • wget -q -O – | sudo gpg –dearmor -o /usr/share/keyrings/kali-archive-keyring.gpg
  3. Ubuntu key for reference:
    • sudo apt-key adv –keyserver –recv-keys 871920D1991BC93C
  4. Add the Kali repository to the /etc/apt/sources.list
    • sudo nano /etc/apt/sources.list
    • Add the following line to the bottom of the sources.
    • deb kali-rolling main non-free contrib
  5. Now run sudo apt update and sudo apt full -upgrade
  6. Now install Kex
    • sudo apt install -y kali-win-kex desktop-base xfce4 xfce4-places-plugin xfce4-goodies
  7. Kex should launch correctly. There are small configuration changes to make
  8. In Windows Terminal, the configuration can be added
    • wsl -d Ubuntu-22.04 kex –sl –wtstart -s
  9. For Ubuntu 22.04 on WSL. This would be the name of your distro on WSL. SL mode is integrated, vs Window mode.
  10. Set the new taskbar to autohide so it doesn’t cover the top of the screen in XFCE

Leave a Reply

%d bloggers like this: