DEV Community

Cover image for WSL+UBUNTU
Anderson Gama
Anderson Gama

Posted on • Updated on

WSL+UBUNTU

#WSL+UBUNTU

Enable Virtual Machine Platform

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Enter fullscreen mode Exit fullscreen mode

Enable Windows Subsystem Linux

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

Update Windows Subsystem Linux

Invoke-WebRequest -Uri https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi -OutFile WSLUpdate.msi -UseBasicParsing
Enter fullscreen mode Exit fullscreen mode
msiexec.exe /package WSLUpdate.msi /quiet
Enter fullscreen mode Exit fullscreen mode

Set Default Version

wsl --set-default-version 2
Enter fullscreen mode Exit fullscreen mode

Download And Import Ubuntu 20.04

Create Folder For ROOTFS

mkdir -p $env:userprofile/Ubuntu/Focal/Ubuntu-20.04
Enter fullscreen mode Exit fullscreen mode

Download ROOTFS Image For WSL

Invoke-WebRequest -Uri https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64-wsl.rootfs.tar.gz -OutFile $env:userprofile/Ubuntu/Focal/Ubuntu-20.04.tar.gz -UseBasicParsing
Enter fullscreen mode Exit fullscreen mode

Import ROOTFS Image For WSL

wsl --import Ubuntu-20.04 $env:userprofile/Ubuntu/Focal/Ubuntu-20.04 $env:userprofile/Ubuntu/Focal/Ubuntu-20.04.tar.gz
Enter fullscreen mode Exit fullscreen mode

List Distributions

wsl --list --all
Enter fullscreen mode Exit fullscreen mode

Set Default Distribution

wsl --setdefault Ubuntu-20.04
Enter fullscreen mode Exit fullscreen mode

List All Distributions And Version

wsl --list --all
Enter fullscreen mode Exit fullscreen mode

Run Distribution

wsl --distribution Ubuntu-20.04
Enter fullscreen mode Exit fullscreen mode

OR

wsl
Enter fullscreen mode Exit fullscreen mode

Sources:
https://docs.microsoft.com/pt-br/windows/wsl/install-win10
https://docs.microsoft.com/en-us/windows/wsl/install-manual
https://wiki.ubuntu.com/WSL

Top comments (0)