+5 votes
76 views
Install Linux WSL2 on Windows

in Windows11 by (552k points)
reopened | 76 views

1 Answer

+3 votes
Best answer

1 How to install WSL 2 on Windows

One of the most striking features of Windows 11 (and already available in Windows 10) is being able to use Linux distributions in Windows making the most of the computer's resources and not having to implement a virtual machine or other similar tools, this is achieved thanks wsl..

 

 

WSL (Windows Subsystem for Linux – Windows Subsystem for Linux) has been developed with the aim of being able to run Linux systems on Windows taking advantage of the hardware and having full access to common Linux utilities, functions and tools such as:

 

Common Linux utilities, functions, and tools
  • Make use of programming languages ​​such as NodeJS, Javascript, Python, Ruby, C/C++ and more
  • Invoke GNU/Linux applications on Windows
  • Make use of Linux graphical applications on Windows 11 / 10 desktop
  • Run and manage services like SSHD, MySQL, Apache, lighttpd, MongoDB and more
  • Make use of tools like nano, vim, emacs, tmux and more
  • Ability to use Bash shell scripts and command line applications

 

In its initial phase WSL 1 was implemented but now we have improvements with WSL 2, WSL 2 is the new version of the Windows Subsystem architecture for Linux and one of its biggest advantages is that it now gives the Windows Subsystem the ability to Linux than running Linux ELF64 binaries on Windows, ELF64 basically allows you to improve file system performance and provide full system call support.

 

Let us take into account that the available Linux distributions can be used with the WSL 1 or WSL 2 architecture as we wish and it is possible to update or downgrade the distribution when we consider it necessary, taking into account that WSL 2 makes use of a completely new architecture taking advantage of the advantages of running a real Linux kernel and this positively impacts system performance..

 

Advantages of WSL 2 that WSL 1 does not offer
Some of the advantages of WSL 2 that WSL 1 does not offer are:
  • Centrally managed virtual machine
  • Full system call support
  • full linux kernel
  • Improved function for VMware and VirtualBox versions
  • Faster boot times
  • Increased file I/O performance

 

TechnoWikis will explain in detail how to install WSL 2 on Windows.

 

 

To stay up to date, remember to subscribe to our YouTube channel!
SUBSCRIBE ON YOUTUBE

 

1 How to install WSL 2 on Windows

 

Step 1

For this case we will use Windows 11 but the process is similar in Windows 10, we open PowerShell as administrator:

 

image

 

Step 2

We install WSL:
 wsl-install 
By executing this command we must accept the UAC terms:

 

 

image

 

Step 3

We confirm the process and wait for it to finish:

 

image

 

Step 4

When finished, Ubuntu will automatically be installed:

 

image

 

step 5

We restart Windows to complete this process:

 

image

 

step 6

Windows will be restarted:

 

image

 

step 7

We start session:

 

image

 

step 8

Logging in will continue with the installation of Ubuntu:

 

image

 

WSL will enable all the system functions that are necessary for optimal operation and if you do not want Ubuntu to be installed automatically, you must add the --no-distribution parameter..

 

step 9

We open PowerShell as administrator again:

 

image

 

step 10

We set WSL 2 as the default version for the distributions to use:
 wsl --set-default-version 2 
image

 

step 11

We list the Linux distributions installed on Windows:
 wsl --list --verbose 
image

 

step 12

Ali we found details such as:
  • Name of the distribution used
  • Actual state
  • used version

 

In case you want to have WSL 1 as well, along with WSL 2, we are going to enable the Windows Subsystem for Linux component with the following command:

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

 

Now we have both versions of WSL and if we want to update from WSL 1 to WSL 2 we execute the following:

 wsl --set-version “distribution” 2 
step 13

We validate the distributions available to install from WSL:
 wsl --list --online 
image

 

step 14

We install the distribution with one of the following options:
 wsl --install --distribution "name" wsl --install "distribution" 
image

 

step 15

Wait for the process to finish:

 

image

 

step 16

When finished, a new window will open with the configuration of the selected distribution:

 

image

 

There we enter the username and password to use.

 

step 17

We list again the Linux distributions installed on Windows:
 wsl --list --verbose 
image

 

We can see that by default it will be used with WSL 2.

 

step 18

We access the distribution from PowerShell with the command:
 wsl -d “name” 
There it is possible to run normal Linux commands:

 

 

image

 

Using the “exit” command we return to the PowerShell console.

 

step 19

Check the WSL status:
 wsl-status 
image

 

step 20

We update WSL:
 wsl-update 
image

 

step 21

To see the global version of WSL we execute:
 wsl –version 
image

 

extra parameters
Some extra parameters to use with WSL are:
  • --cd <Directory>: set the indicated directory as the current working directory
  • --distribution, -d (distro): run the given distribution
  • --user, -u (user): run as the given user
  • --system: launches a shell for the open system distribution
  • --no-launch, -n: Don't open the distribution after it's installed
  • --web-download: download the distribution from the web but not from the Microsoft Store
  • --pre-release: Allows you to download a pre-release if available
  • --mount <disk> – Attach and mount a physical or virtual disk on all available WSL 2 distributions
  • --shutdown: Terminates all running WSL 2 distributions by shutting them down
  • --status: show the status of WSL
  • --update: update WSL

 

We see how WSL is an ally to use Linux distros on Windows, taking advantage of all available resources.

 


by (3.5m points)
edited

Related questions

+4 votes
1 answer
asked Oct 9, 2023 in Windows11 by backtothefuture (552k points) | 67 views
+4 votes
1 answer
asked Aug 15, 2023 in Windows11 by backtothefuture (552k points) | 68 views
+3 votes
1 answer
asked Dec 12, 2022 in Windows11 by backtothefuture (552k points) | 84 views
+5 votes
1 answer
asked Aug 7, 2023 in Otherapps by backtothefuture (552k points) | 116 views
+3 votes
1 answer
asked Jun 25, 2020 in Windows 10 by backtothefuture (552k points) | 251 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users