Kali on WSL with Win-Kex

Hey again! Hope you're doing good as usual. In this blog, we are going to look at WSL, and how we can install Kali on WSL. Microsoft says,


The Windows Subsystem for Linux lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.

This is the guide to install a Linux Distribution like Kali Linux, Ubuntu, etc. using WSL or Windows Subsystem for Linux.


Prerequisites


You must be running Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11.


To check your Windows version and build number, select Windows logo key + R, type winver, select OK. You can update to the latest Windows version by selecting Start > Settings > Windows Update > Check for updates.


Install WSL command


You can now install everything you need to run Windows Subsystem for Linux (WSL) by entering this command in an administrator PowerShell or Windows Command Prompt and then restarting your machine.


An interesting way to open powershell in administrator mode is to do : type win + r -> type powershell -> press ctrl + shift + enter. With this, powershell will run as administrator user.

wsl --install

Now, after reboot, visit https://www.kali.org/get-kali/#kali-wsl and that will redirect us to Windows App Store from where we can get our Kali Linux. We can click on "Get in Store app" and it will start downloading the Kali,


We can see that our Kali is downloaded,


Now, let's start it by clicking on Open button, and it will take a few minutes to install, and then it will prompt us to enter the credentials, so we'll do that, and then we are ready to use our Kali. Just like this,

Now that we are done with installation of Kali, let's move to GUI installation of Kali. (:


Visit https://www.kali.org/get-kali/#kali-wsl and click on the WSL Documentation. There we will see 4 types of Kex softwares, and we have to install the 1st one, i.e., Win-Kex


Install Win-KeX


Now, let's click on it, and we can see the documentation of installation of Win-Kex software on Kali. Scroll down, and we will see the commands to install the Win-Kex software,


Now, let's update the Kali first using,


sudo apt update && sudo apt upgrade

Now, we need to copy-paste the following command on the terminal, and it will start downloading the Win-Kex software on our Kali,


sudo apt install -y kali-win-kex

Run Win-Kex


Now, next step is to decide which mode we want to run Win-Kex as it supports three modes,


1. Window Mode


To start Win-KeX in Window mode with sound support, run


kex --win -s

Refer to the Win-KeX Win usage documentation for further information.


2. Enhanced Session Mode


To start Win-KeX in Enhanced Session Mode with sound support and arm workaround, run


kex --esm --ip -s

Refer to the Win-KeX ESM usage documentation for further information.


3. Seamless mode


To start Win-KeX in Seamless mode with sound support, run


kex --sl -s

Refer to the Win-KeX SL usage documentation for further information.


But for now, we will move forward with installation of Win-kex, i.e., 1st mode, and after running the command, we will get our Kali running,


kex --win -s

Or if we want to run it as seamless, we can also run it using,


kex --sl -s

Uninstall WSL from Windows 10


If we want to uninstall WSL from Windows 10 Completely, we need to remove the distros, kernel update, and then the remaining components.


Remove Linux distros


To uninstall a distro of Linux from WSL, use these steps:


Settings → Apps → Search Kali → Click Uninstall,


It will remove the distribution from windows.


Remove Windows Subsystem for Linux components


To uninstall the WSL Linux kernel update and GUI components on Windows 10, use these steps:


Settings → Apps → Search Linux → Click Uninstall.


Remove WSL from Windows 10


<