Page MenuHomePhorge

Windows Subsystem for Linux
Updated 836 Days AgoPublic

Setup

  1. In an Admin PowerShell session, run dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  2. Consider virtualization levels:
    1. If you want to use hardware virtualization stuff then also run dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart but honestly I've never yet once done this, especially since I'm often using Windows in a VM already and nesting gets . . . tricky.
    2. Conversely, to expressly use WSL1 instead and not have to worry about this, wsl --set-default-version 1 (newer versions of Windows will default to WSL2).
  3. Now (maybe after a restart; verified not necessary using WSL1 on Windows 11) you should have the wsl command available to you. Get a list of distros with wsl --list --online
  4. Install your distro of choice with wsl --install -d distroname

Official docs (not always up to date)

Issues

Using something like rsync on the filesystem outside of WSL (ex. something on /mnt/c, where the C:\ drive is automounted by default) will throw errors because the user doesn't have permissions to change some file properties. See https://github.com/microsoft/WSL/issues/3187#issuecomment-388904048, the lazy solution however is to just use sudo in those instances.

Last Author
keithzg
Last Edited
Sep 7 2022, 6:19 PM

Event Timeline

Noting how to mount UNC paths from within WSL: sudo mount -t drvfs '\\server\share' /mnt/share

keithzg published a new version of this document.