-
Open a PowerShell window with administrative privileges.
-
Run the following commands to enable WSL and Virtual Machine Platform features:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart # Restart your computer to apply changes Restart-Computer
-
After restarting, open PowerShell.
-
Update the WSL kernel:
wsl --update
-
Set WSL2 as the default version:
wsl --set-default-version 2
-
Install Ubuntu 24.04:
wsl --install -d Ubuntu-24.04
-
Update Ubuntu packages after installation:
sudo apt update && sudo apt full-upgrade -y
For more information about the WSLg Links project, visit viruscamp WSLg Links.
-
Install WSLg Links:
# Using unzip (if installed) # sudo apt install unzip wget https://github.com/viruscamp/wslg-links/archive/refs/heads/main.zip unzip main.zip && cd wslg-links-main # Using git (if installed) # sudo apt install git git clone https://github.com/viruscamp/wslg-links.git cd wslg-links sudo cp wslg-tmp-x11.service /usr/lib/systemd/system/ sudo cp wslg-runtime-dir.service /usr/lib/systemd/user/ sudo systemctl enable wslg-tmp-x11 sudo systemctl --global enable wslg-runtime-dir exit
-
Shutdown WSL:
wsl --shutdown
-
Open the Ubuntu terminal in WSL2:
wsl -d Ubuntu-24.04 --cd ~
export LIBGL_ALWAYS_SOFTWARE=true
export GALLIUM_DRIVER=llvmpipe
# Alternative:
# export GALLIUM_DRIVER=softpipe
Follow the Microsoft WSL2 GUI setup documentation for prerequisites. (Installed driver for vGPU)
export GALLIUM_DRIVER=d3d12
export MESA_D3D12_DEFAULT_ADAPTER_NAME=INTEL
export GALLIUM_DRIVER=d3d12
export MESA_D3D12_DEFAULT_ADAPTER_NAME=NVIDIA
export GALLIUM_DRIVER=d3d12
export MESA_D3D12_DEFAULT_ADAPTER_NAME=AMD
This guide provides a comprehensive setup for WSL2 with Ubuntu 24.04, including optional GUI configurations. Ensure all dependencies are installed as needed.