This guide shows how to install Windows Subsystem for Linux (WSL2).
WSL (Windows Subsystem for Linux) allows running Linux directly in Windows:
/mnt/c/, /mnt/d/, etc.Why do we need WSL?
# As Administrator in PowerShell: wsl --install -d Ubuntu-22.04
This installs:
After installation: Restart computer!
# Enable WSL and Virtual Machine Platform dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Restart computer.
wsl --set-default-version 2
Ubuntu (recommended):
wsl --install -d Ubuntu-22.04
Fedora (alternative):
# Fedora manually from Microsoft Store or:
winget install WhitewaterFoundry.Fedora.39.WSL
On first start, Ubuntu asks for:
dev)After WSL installation, build tools need to be installed:
# Open WSL wsl # Update system sudo apt update && sudo apt upgrade -y # Install build tools sudo apt install -y \ build-essential \ perl \ nasm \ git \ cmake \ pkg-config
# Open WSL wsl # Install build tools sudo dnf install -y \ gcc \ gcc-c++ \ make \ perl \ nasm \ git \ cmake
# Check compiler gcc --version # Should show: gcc (Ubuntu 11.x.x) ... # Check Perl perl -v # Should show: This is perl 5... # Check NASM nasm -v # Should show: NASM version 2.x
All Windows drives are mounted:
# C: drive ls /mnt/c/ # D: drive (our projects) ls /mnt/d/Projects/openssl-3.6.0/
\\wsl$\Ubuntu-22.04\home\<user>\
In Explorer: Type \\wsl$ in the address bar.
Files in Linux filesystem are faster!
| Location | Performance |
| ———- | ————- |
/mnt/d/… | Slow (Windows filesystem) |
~/… | Fast (Linux filesystem) |
Recommendation for build:
# Copy sources to Linux cp -r /mnt/d/Projects/openssl-3.6.0/src ~/openssl-src # Build in Linux filesystem cd ~/openssl-src ./Configure linux-x86_64 --prefix=~/openssl-build make -j$(nproc) # Copy result to Windows cp -r ~/openssl-build /mnt/d/Projects/openssl-3.6.0/linux-build/
# Update WSL kernel wsl --update
Enable in BIOS:
Work in Linux filesystem (~/) instead of under /mnt/.
Wolfgang van der Stille @ EMSR DATA d.o.o. - Post-Quantum Cryptography Professional