Kali Linux (Windows Subsystem for Linux)

The Windows Subsystem for Linux (WSL) is a compatibility layer developed by Microsoft that allows you to run a Linux environment directly on Windows without the need for a virtual machine or dual-boot setup. This guide will show you how I set up my Kali WSL.

Requirements

  • Windows 11/Windows 10 v2004+

Enabling Windows Subsystem for Linux (WSL)

Read Microsoft Learn's documentation for more detailed and up-to-date information.

Run the Windows Command Prompt or PowerShell as administrator and run the following command:

wsl --install --no-distribution

If you have to install WSL manually, you have to run the following commands instead:

# Enable "Windows Subsystem for Linux" optional feature.
dism /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
 
# Enable "Virtual Machine Platform" optional feature.
dism /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

After a system restart, you’ll have to download and install the Linux kernel update package.

Installing and Setting Up Kali Linux WSL

Open a Windows Command Prompt or PowerShell, and run the following command to install Kali Linux WSL:

wsl --install kali-linux

It is recommended that you install from the Microsoft Store instead.

It will start downloading the distribution and after a few minutes you will be asked for a new UNIX username and password. When you finished setting up the your new Kali Linux credentials, update the system.

sudo apt update
sudo apt upgrade

Edit the /etc/wsl.conf file according to your needs. You can see the documentation here: Advanced settings configuration in WSL | Microsoft Learn

[boot]
systemd = true
 
[automount]
enabled = true
 
[network]
hostname = edgeRunner
generateHosts = false
 
[interop]
enabled = false
appendWindowsPath = false

After changing the hostname via wsl.conf, you now have to update the hosts file. Open it and change all occurences of the old hostname with the new hostname you’ve chosen.

sudo -e /etc/hosts

I recommend that you use my custom ZSH configuration for more convenience. After that, we’ll have to install some dependencies of the packages that we’ll download and install.

sudo apt install \
    7zip 7zip-rar dotnet-sdk-6.0 file \
    fuse gcc git git-lfs gh jq make \
    mc nodejs npm pipx python3 \
    python3-pip python3-venv \
    tealdeer tmux trash-cli \
    tree-sitter-cli \
    unrar unzip zip
pipx install howdoi yt-dlp magika jupyterlab poetry

It is also a good time to create directories that you’ll use often:

mkdir Downloads Projects Temp

Download software that are not available on the Kali repositories or are not up-to-date:

# Install pfetch
curl -Lo ~/.local/bin/pfetch "https://raw.githubusercontent.com/Un1q32/pfetch/refs/heads/master/pfetch" && chmod +x ~/.local/bin/pfetch
 
# Install Neovim
curl -Lo ~/.local/appimages/nvim "$(curl -s https://api.github.com/repos/neovim/neovim/releases/latest | grep -o 'https://.*nvim\.appimage' | head -n 1)" && chmod +x ~/.local/appimages/nvim

I also recommend that you install my custom Neovim configuration if you’re using Neovim for software development.