Skip to content

Latest commit

 

History

History
121 lines (69 loc) · 3.38 KB

WSL2-Setup-Guide.md

File metadata and controls

121 lines (69 loc) · 3.38 KB

Install WSL with a single command now available in Windows 10 version 2004 and higher

With Windows 10 "2004" [20H1] (Build: 19041), it's no longer necessary to manually install WSL. To install, simply execute in shell:

wsl.exe --install

Manual Installation for WSL2

  1. Add the following Windows features:

    • Windows Subsystem for Linux (WSL required)

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

    • Virtual Machine Platform (WSL2)

    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

  2. Windows needs to be rebooted.

    shutdown /r /t 10 /c "WSL Setup" /d p:2:4

  3. Install Linux Kernel update package

    Direct link to msi

	cd %PUBLIC%\Downloads
	wget "https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi"
	wsl_update_x64.msi /passive /q /forcerestart
  1. Set WSL 2 as default

    wsl --set-default-version 2

  2. Install Linux distro's from Microsoft Store

    MS WSL Store

    wsl --list --online # Doesn't work

    Chocolatey Repo

    Requires Chocolatey to be installed!

    choco install wsl-alpine /y
    choco install wsl-ubuntu-2004 /y
    choco install wsl-archlinux /y
    choco install wsl-fedoraremix /y
    choco install wsl-debiangnulinux /y
    choco install wsl-kalilinux /y
    choco install wsl-opensuse /y
    choco wsl-kalilinux wsl-opensuse /y
    

Install multiple at once:

choco install wsl-alpine wsl-ubuntu-2004 wsl-archlinux wsl-fedoraremix wsl-debiangnulinux /y
  1. Set username and password for distro

  2. Update distribution with package manager

    [Debian Lineage]

    apt update

    apt upgrade

    [RHEL Lineage]

    dnf upgrade --refresh

    [Alpine Lineage]

    apk update

    apk upgrade

Notes:

  • all files by default are located in the user profile:

    C:\Users\<user>\AppData\Local\Packages

  • main file is a virtual harddisk: ext4.vhdx

  • Change location for a distro

    [EXPORT]

    wsl.exe --export <Distro> <FileName>

    [IMPORT]

    wsl.exe --import <Distro> <InstallLocation> <FileName> [Options]

  • To access wsl linux distro file system from Windows

    \\wsl$\<distroName>

  • LAN Networking (port proxy)

    netsh interface portproxy add v4tov4 listenport=<port#> listenaddress=0.0.0.0 connectport=<port#> connectaddress=<VM IP Address>

    e.g. netsh interface portproxy add v4tov4 listenport=4000 listenaddress=0.0.0.0 connectport=4000 connectaddress=192.168.101.100

  • Default storage capacity is up to 256 GB

    To expand, follow the following instructions.

Limitations

  • Cross file system is slow, i.e. linux internally using windows files.
  • no pre-built CENTOS distro
  • no IPv6 support