Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xardit/e75d85c38b5232e6473431526afbb702 to your computer and use it in GitHub Desktop.
Save xardit/e75d85c38b5232e6473431526afbb702 to your computer and use it in GitHub Desktop.
Setup WSL 2 with Kali or Ubuntu with Desktop GUI on Windows 10

Setup WSL 2 (Windows Subsystem for Linux) with Kali or Ubuntu with Desktop GUI on Windows 10

Requirement

Windows 10 minimum version 2004 Build 19041 (find it by using Win+R, type winver then [ENTER] )

Steps

  1. Run PowerShell as Administrator and type
 Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  1. Restart

  2. Run again PowerShell as Administrator and type

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  1. Restart

  2. Download and install Windows Subsystem for Linux v2 here: https://aka.ms/wsl2kernel

  3. Run PowerShell as Administrator and type

wsl --set-default-version 2

You may check version of WSL using command wsl --list --verbose

Or if needed to convert a specific distro to WSL version 2 type wsl --set-version Ubuntu 2

  1. Install from Windows Store Windows Terminal

  2. Install from Windows Store Kali Linux or Ubuntu or both if you like

  3. Run Kali or Ubuntu from Start Menu or from Windows Terminal (type command kali or ubuntu)

  4. For Desktop GUI access

For Kali Linux using xfce and RDP to remote

# Upgrade current packages and install desktop gui
sudo apt update && sudo apt upgrade -y
sudo apt install kali-desktop-xfce -y
# Install and start remote xrdp service for remote control
sudo apt install xrdp -y
sudo service xrdp start

For Ubuntu using kubuntu and RDP to remote

# 1. Upgrade current packages and install desktop gui
sudo apt update && sudo apt -y upgrade
sudo apt-get install -y kubuntu-desktop
# on the prompt select "lightdm"
# Install xrd for remote control, also change port ot 3390 and add some optimizations on the config file
sudo apt-get install -y xrdp
sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak
sudo sed -i 's/3389/3390/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/max_bpp=32/#max_bpp=32\nmax_bpp=128/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/xserverbpp=24/#xserverbpp=24\nxserverbpp=128/g' /etc/xrdp/xrdp.ini
# Start the remote xrdp service
sudo /etc/init.d/dbus start
sudo /etc/init.d/xrdp start
  1. Gain access on remote using Windows Remote Desktop Connection or Win+R and type mstsc
    Use host credentials and ip address of host (gain ip from command ip addr on the host), or if you use different port you may be typing SOME_IP:PORT

by diti

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment