Linux on Windows with WSL

[1] The Windows Subsystem for Linux (WSL) lets developers use Linux applications, utilities, and Bash command-line tools directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.


These instructions are for Ubuntu


You must be running Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11

Open PowerShell or Windows Command Prompt in administrator mode.

Install WSL

wsl --install

Check WSL version

New Linux installations, installed using the wsl –install command, will be set to WSL 2 by default.

wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu                 Running         2


Update previously installed Linux distributions from WSL 1 to WSL 2 and update your WSL version to the latest version.

wsl --set-default-version 2
wsl --update

Connect USB devices [2]

Install the USBIPD-WIN project

Support for connecting USB devices is not natively available in WSL, so you will need to install the open-source usbipd-win project.

Install usbipd-win:


In case you have used usbipd with WSL 2 before, the following has changed since version 4.0.0:

  • You have to share the device using usbipd bind first.

  • You no longer have to install any client-side tooling.

  • You no longer have to specify a specific distribution.

  • The syntax for the command to attach has changed slightly.

Attach a USB device


Before attaching your USB device, ensure that a WSL command line is open. This will keep the WSL 2 lightweight VM active.

List all of the USB devices connected to Windows

usbipd list
BUSID  VID:PID    DEVICE                                                        STATE
2-2    0483:df11  DFU in HS Mode @Device ID /0x500, @Revision ID /0x0000        Not attached

Select the bus ID of the device you’d like to attach to WSL.

Before attaching the USB device, the command usbipd bind must be used to share the device, allowing it to be attached to WSL. This requires administrator privileges. Select the bus ID of the device you would like to use in WSL and run the following command.

usbipd bind --busid 2-2

To attach the USB device, run the following command. (You no longer need to use an elevated administrator prompt.) Ensure that a WSL command prompt is open in order to keep the WSL 2 lightweight VM active.

usbipd attach -a --wsl --busid 2-2

WSL NFS Server

brief description how to share /nfsshare with everyone

sudo apt install nfs-kernel-server rpcbind
sudo mkdir /nfsshare
sudo chown nobody:nogroup /nfsshare
sudo chmod 777 /nfsshare
sudo sh -c "echo '/nfsshare *(rw,sync,no_subtree_check,insecure,no_root_squash)' >> /etc/exports"
sudo service rpcbind start
sudo service nfs-kernel-server start
sudo exportfs -a

IP address of your Linux distribution installed via WSL 2 (the WSL 2 VM address)

wsl hostname -I

Map ports 443, 2049 to WSL

netsh interface portproxy add v4tov4 listenport=443 listenaddress= `
connectport=443 connectaddress=(wsl hostname -I)
netsh interface portproxy add v4tov4 listenport=2049 listenaddress= `
connectport=2049 connectaddress=(wsl hostname -I)

Add Firewall rules

netsh advfirewall firewall add rule name="WSL NFS IN" dir=in `
action=allow protocol=TCP localport=111,2049
netsh advfirewall firewall add rule name="WSL NFS OUT" dir=out `
action=allow protocol=TCP localport=111,2049