Skip to content

Deploy WSL2 on Windows

cpx March 23, 2025 1 min read MSWindows (MSFT) MSWindows 11

Select available Linux and install it

wsl --list --online
wsl --install Ubuntu

Edit the Hyper-V vSwitch

notepad %USERPROFILE%\.wslconfig

[wsl2]
vmSwitch="WSL"
dhcp=true
ipv6=false

memory=4GB
processors=12
localhostForwarding=true

wsl

vi /etc/wsl.conf

[boot]
systemd=true

[user]
default=user
echo -e "network:\n version: 2\n renderer: networkd\n ethernets:\n eth0:\n dhcp4: true\n optional: true" | sudo tee /etc/netplan/01-netcfg.yaml && sudo netplan apply

VMWare env setup

@echo off
setlocal enabledelayedexpansion

set "VMW_PATH=C:\Program Files (x86)\VMware\VMware Workstation"
cd /d "%VMW_PATH%"

for /f "tokens=*" %%i in ('vmrun.exe list') do (
    set line=%%i
    if "!line:~0,4!" NEQ "Total" (
        if "!line!" NEQ "" (
            echo Starting VM: !line!
            vmrun.exe start "!line!" nogui
        )
    )
)

0 0 votes
Article Rating
guest

0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x