How to setup of WSL2 on Windows 10 and Windows 11

open up PowerShell and enter this command:
wsl –install

enable Windows Subsystem for Linux

Open PowerShell as administrator and enter this command:

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

so don’t reboot it yet

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

now reboot

Download the WSL2 Kernel update.
install it please.

run this command
wsl –set-default-version 2

check and see what you have installed
wsl –list –verbose

wsl –set-version <distribution name> <versionNumber>
ex: wsl –set-version debian 2

almost there:
load your Linux installations via PowerShell

wsl -d <distribution name>
ex: wsl -d debian

To Do:-
install docker containers ex: nginx, php, mysql etc…
setup wsl2 with windows network: Bridge mod, so no need to port forward

NAME COMMAND SERVICE STATUS PORTS
laradock-docker-in-docker-1 “dockerd-entrypoint.…” docker-in-docker running 2375-2376/tcp
laradock-mysql-1 “docker-entrypoint.s…” mysql running 0.0.0.0:3306->3306/tcp
laradock-nginx-1 “/docker-entrypoint.…” nginx running 0.0.0.0:80-81->80-81/tcp, 0.0.0.0:443->443/tcp
laradock-php-fpm-1 “docker-php-entrypoi…” php-fpm running 0.0.0.0:9003->9003/tcp
laradock-redis-1 “docker-entrypoint.s…” redis running 0.0.0.0:6379->6379/tcp
laradock-workspace-1 “/sbin/my_init” workspace running 0.0.0.0:2222->22/tcp, 0.0.0.0:3000-3001->3000-3001/tcp, 0.0.0.0:4200->4200/tcp, 0.0.0.0:8001->8000/tcp, 0.0.0.0:8080->8080/tcp

1 thought on “How to install Linux WSL2 on Windows 10 and Windows 11”

Leave a Reply

Your email address will not be published.