Install Kali Linux using Windows Subsystem for Linux (WSL) on Server 2019
How to install Kali Linux using Windows Subsystem for Linux (WSL) on Server 2019. Enable WSL feature using PowerShell. Install Kali Linux using an Appx Package
Table of Contents
1. Enable Windows Subsystem for Linux (WSL) feature using PowerShell
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
2. Install Kali Linux on WSL using an Appx Package
Download Kali Linux Appx Package using PowerShell
# create folders mkdir C:\Install\KaliLinux cd C:\Install\KaliLinux # Download Kali Linux Appx Bundle Invoke-WebRequest -Uri "https://aka.ms/wsl-kali-linux" -OutFile "Kali.appx" -UseBasicParsing
Rename appx to zip and extract using PowerShell
# rename appx to zip and extract Rename-Item Kali.Appx Kali.zip Expand-Archive Kali.zip .\Temp # rename DistroLauncher to zip and extract Rename-Item .\Temp\DistroLauncher-Appx_1.1.4.0_x64.appx DistroLauncher.zip Expand-Archive .\Temp\DistroLauncher.zip C:\Install\KaliLinux\Live
The Live folder contains the extracted Kali linux executable
3. Launch Kali Linux using PowerShell
Start-Process -FilePath C:\Install\KaliLinux\Live\kali.exe
Kali Linux will start, you'll be asked to enter a username and password
Create a desktop shortcut "Kali WSL"
C:\Install\KaliLinux\Live\kali.exe
4. Install Kali Linux updates
The first thing you will do with a new Linux machine is install updates. In this case, we get the following errors when running sudo apt update && sudo apt upgrade
An error occurred during the signature verification. The repository is not updated and the previous index files will be used.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://kali.download/kali kali-rolling InRelease: The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository
W: Failed to fetch http://http.kali.org/kali/dists/kali-rolling/InRelease The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository
W: Some index files failed to download. They have been ignored, or old ones used instead.
Install Kali archive keys from Debian package
This error can be fixed by installing the Kali archive keys manually using the Debian .deb package file
cd ~ # download keyring wget http://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2022.1_all.deb # install keyring sudo dpkg -i kali-archive-keyring_2022.1_all.deb # remove file rm kali-archive-keyring_2022.1_all.deb
Run apt update and apt upgrade
sudo apt update && sudo apt upgrade
5. Troubleshooting sudo issues on WSL
If you're having problems running sudo with Kali running on WSL, take a look at this troubleshooting article..
SOLVED: sudo: account validation failure, is your account locked? sudo: 3 incorrect password attempts
Please give this article a rating (by clicking the stars) or leave a comment below!
Reference:
by Author
WSL - Windows Server Installation Guide
https://learn.microsoft.com/en-us/windows/wsl/install-on-server
Comments