Introduction
Have you ever wanted the power of Kali Linux without the complication of dual-booting or virtual machines? Thanks to Windows Subsystem for Linux (WSL2), you can now run Kali Linux seamlessly on your Windows PC. This guide will walk you through the simple steps to set up Kali Linux on WSL2, complete with a graphical interface, so you can dive into the world of ethical hacking and cybersecurity right from your desktop.
Why Use WSL?
Here’s why WSL is an excellent choice:
Smooth Integration: Execute Linux and Windows commands side by side.
Choice of Distributions: Install multiple Linux distros like Ubuntu, Debian, and Kali Linux.
Improved Performance: WSL 2 includes a full Linux kernel, offering faster performance.
Safe Testing: Provides a secure environment for experimenting with Linux commands.
Lightweight: Uses fewer system resources than traditional virtual machines.
Dual Environments: Run Windows and Linux simultaneously.
File System Access: Seamlessly access your Windows files from Linux.
Installation Steps
Step 1: Update Your PC
Ensure your Windows PC is updated to avoid compatibility issues.
Open Settings: Press
Win + I
or click the Start button and select Settings.Navigate to Updates: Go to Windows Update.
Check for Updates: Click the Check for updates button.
Install Updates: Allow Windows to download and install any updates.
Restart if Required: Some updates may need a restart to complete.
Step 2: Enable WSL
WSL must be enabled to support Linux distributions.
- Open PowerShell:
PressWin + S
, search for PowerShell, right-click, and select Run as Administrator.
2. Enable WSL: Run the following command:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Enable Virtual Machine Platform: Run:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Step 3: Set WSL 2 as the Default Version
Ensure that WSL 2 is set as the default version for better performance.
Run the command:
wsl --set-default-version 2
- If it fails, update your WSL kernel (see Step 4).
Step 4: Update the WSL Kernel
Download the latest WSL 2 kernel update package from Microsoft's website:
Visit the official Microsoft WSL Kernel Update page:
- Run the downloaded installer to install the kernel.
Retry setting WSL 2 as the default version:
wsl --set-default-version 2
Step 5: Install a Linux Distribution
Install Kali Linux from the Microsoft Store.
Open the Microsoft Store.
Search for "Kali Linux".
Click Get to download and install it.
Launch the Kali Linux distribution from the Start Menu to complete the setup.
Set up your username and password when prompted.
Verify the Kali Linux installation:
cat /etc/os-release
Step 6: Verify WSL 2 Installation
Open PowerShell and run:
wsl --list --verbose
Your installed Linux distributions should appear, with version 2 indicating WSL 2
Step 7: Install the Graphical User Interface (GUI)
Launch Kali Linux: Open it from the Start Menu.
Update and Upgrade the System:
sudo apt update && sudo apt upgrade -y
Install the Kex Server:
sudo apt install -y kali-win-kex
Launch the Kex Server:
kex
Enter Your Password: When prompted, enter your user password
- The kex server is now running, providing a graphical user interface (GUI).
Conclusion
Congratulations! You now have Kali Linux running on WSL2 with a fully functional graphical interface. This setup allows you to explore the powerful tools of Kali Linux while enjoying the integration with your Windows environment.
Have any questions or feedback? Drop them in the comments below!