How To Install Wsl2 On Windows 10 11 Windows Subsystem For Linux 2

How To Install Wsl2 On Windows 10 11 Windows Subsystem For Linux 2
  • Jan 16th, 2024
  • Anshu Chauhan
  • Laptop
    • Share :

Best Way To Install WSL2 (Windows Subsystem For Linux 2) On Windows 10 & 11

How To Install WSL2 On Windows 10 & 11 (Windows Subsystem for Linux 2)

This is how to install wsl2 on Windows 10 and begin using Windows Subsystem for Linux 2, now available on Windows 10 and 11 with several changes.

  • Run "wsl -install" in Command Prompt as an administrator to install wsl2 on Windows 10.

  • The Ubuntu Linux distro and the WSL2 components will be installed using the command.

  • Run "wsl -install -d DISTRO-NAME" to install wsl2 on Windows 10 a specific distro.

  • The "wsl -update" command should be used to update the WSL2 kernel.

WSL2 (Windows Subsystem for Linux version 2) is a new version of the architecture that takes the place of WSL and enables native Linux to be used on top of Windows 10 (using a small virtual machine).

The feature now uses an actual Linux kernel, which enhances speed and app compatibility over the earlier iteration while preserving the original release's user interface. You may learn how to install wsl on Windows 10 from this tutorial.

How To Enable Windows Subsystem For Linux

You must first have WSL to obtain WSL2, or I can say how to install WSL2 on Windows 10. The procedures for enabling the first and second iterations are somewhat different, which may seem confusing. However, you must first own the original to possess the most recent. There isn't a simple way to merely install Ubuntu in wsl2.

The Windows Subsystem for Linux has a comprehensive setup guide that you should read for a thorough introduction to installing wsl2 on Windows 10, but if you want to get started quickly, you need to add one line of code to your machine.

Enter the following command after starting PowerShell as an administrator:

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

You will eventually have to restart your computer, but if you're installing WSL2, you can put that off for now.

How To Install WSL2 On Windows 10

On Windows 10 2004 and later editions (including versions 21H2 and 21H1), Microsoft has made the installation of the WSL simpler by reducing it to a single command that downloads and installs Ubuntu on WSL2 and all necessary parts, including Ubuntu Linux by default and the virtual machine platform.

Follow these instructions to install Ubuntu in wsl2 (Windows Subsystem for Linux on Windows 10):

Launch Windows 10 Start.

Enter "Command Prompt" into the search box, right-click the first result, and choose "Run as administrator."

To install Ubuntu on wsl2 on Windows 10, enter the following command and then hit Enter:

will --install

To complete the WSL installation on Windows 10, restart your computer.

As required, continue setting up the Linux operating system.

Once you've finished the instructions, the necessary Linux components will automatically install wsl2 in Windows 11, the most recent version of the Ubuntu Linux distribution,

Also Read: How To Download BlueStacks In Laptop

Install WSL With Specific Distro

Follow these instructions to install Kali Linux in wsl2 with a particular distribution on Windows 10:

  1. Launch Start.

  2. Enter "Command Prompt" into the search box, right-click the first result, and choose "Run as administrator."

  3. To display a list of WSL distributions, you may install Ubuntu wsl2 Windows 10. Type the following command and hit Enter:

we --list --online
Quick note: At the time of this writing, you can do wsl2 install Ubuntu 20.04, Debian, Kali Linux, openSUSE, and SUSE Linux Enterprise Server.

  1. To install wsl2 on Windows Server 2019 with a particular distro on Windows 10, enter the command below and press Enter.
    wsl --install -d DISTRO-NAME

    Don't forget to substitute the name of the distro you wish to install for "DISTRO-NAME" in the command, for example, Debian.

  2. Switch off your computer.

  3. As required, continue setting up the Linux distribution.

The Windows Subsystem for Linux 2 components will be Windows WSL2 installed alongside the Linux distribution you choose once you've finished the instructions.

Update WSL Kernel

Follow these procedures to upgrade the WSL kernel to the most recent version:

  1. Launch Start.

  2. Enter "Command Prompt" into the search box, right-click the first result, and choose "Run as administrator."

  3. To upgrade the WSL kernel, enter the command after typing it:

will --update

If an update is available after you finish the instructions, it will download and install wsl2 Windows 10 Home on the device. Open Settings > Upgrade & Security > Windows Update > Advanced settings and toggle on "Receive updates for other Microsoft products when you update Windows" if the update command doesn't function.

Install WSL2 On Windows 10 1909 Or Older

How to install WSL2 on Windows Server 2019; alternatively, you may still install WSL on Windows 10 versions 1909 and before via the traditional procedures. The procedure entails turning on WSL1, the Virtual Machine Platform, updating current distributions (if necessary), and setting the Windows Subsystem for Linux 2 as the new default for the upcoming distribution installation. The Linux integration is supported on versions 2004 and higher if you have an ARM64 machine.

Enable Windows Subsystem For Linux

The Windows Subsystem for Linux (version 1) must be enabled if you are not currently utilizing Linux on Windows 10 by following these instructions:

  1. Launch Windows 10 Start.

  2. Click the first result after searching for Turn Windows features on or off to launch the experience.

  3. Ensure that "Windows Subsystem for Linux" is selected.

  4. Choose the OK option.

  5. Select Restart from the menu.

You must activate the Virtual Machine Platform functionality after finishing the instructions.

Also Read: How To Install Hinglish Keyboard In Laptop

Enable Virtual Machine Platform

Follow these steps to activate the Virtual Machine Platform on Windows 10:

Advisable: The Basic Input/Output System (BIOS) or Unified Extensible Firmware Interface (UEFI) must have the option to activate virtualization, and the motherboard and CPU must support virtualization (UEFI).

  1. Launch Start.

  2. Right-click the first result from your search for PowerShell and choose "Run as administrator."

  3. Type the following command to enable the Virtual Machine Platform capability and hit Enter.
    Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

  4. Switch off your computer.

Following the methods, you may convert current distros and make the Windows Subsystem for Linux version 2 the new default architecture.

Enable Windows Subsystem For Linux 2

Use these procedures to start utilizing WSL2 or convert existing WSL distributions to WSL2:

  1. Download the most recent WSL 2 kernel (required).

  2. Apply the update by double-clicking the wsl update x64.msi file.

  3. Launch Start.

  4. Right-click the first result from your search for PowerShell and choose "Run as administrator."

  5. When installing new distributions, use the following command and press Enter to make Windows Subsystem for Linux 2 your default architecture:

will --set-default-version 2

  1. (Optional) To switch the distribution from WSL to WSL 2, use the following command and hit Enter:

Will --set-version Ubuntu 2

In the command, change "Ubuntu" for the distro's name you want to convert. If you do not know the distro's name, use the wsl -l -v command.

Your device will begin utilizing the new version of Windows Subsystem for Linux 2 as the default architecture as soon as you finish the instructions.

Confirm Distro Platform

Use these techniques to determine whether a distro is running Windows Subsystem for Linux 2:

  1. Launch Start.

  2. Right-click the first result from your search for PowerShell and choose "Run as administrator."

  3. To check the distribution version, use the following command and hit Enter:

will --list --verbose

  1. Verify that the distro's version is 2.

You will know if the procedure was successful or if you need to troubleshoot any of the processes after finishing the steps.

How To Install WSL2 On Windows 11 With GUI Support

Microsoft is streamlining the Windows Subsystem for Linux 2 (WSL) installation procedure on Windows 11 by reducing it to a single command that downloads and installs WSL2 GUI and all necessary components, including the virtual machine platform and Linux GUI programs.

Additionally, by default, the script installs the most recent Ubuntu distribution. If you prefer another Linux distribution, there is an option to append in the hand to pick another distro installation. You will discover yet another method to make updating the kernel with a single command more straightforward in addition to the new quick and straightforward procedure. You will learn from this article how to install SSL on Windows 10 on your device in a few simple steps. We will also describe installing Ubuntu GUI on wsl2 on Windows 11.

Install Ubuntu On WSL2 On Windows 11 With GUI Support

1. Overview

You may quickly install wsl2 for Windows 10, a complete Ubuntu terminal environment on a Windows computer using Windows Subsystem for Linux (WSL), which enables you to create cross-platform software without ever leaving Windows.

What you will discover for wsl2 Windows install

  • How to install and make WSL available on Windows 11

  • How to set up and execute a straightforward WSLg-based graphical application

  • How to set up and operate a much more sophisticated WSLg application

  • Please go to our alternate instructions here if you are a Windows 10 user.

What you'll require is:

A natural or virtual PC running Windows 11 and having all the updates installed

Note: GPU acceleration is discussed in a separate tutorial and is not addressed in this one.

2. Install WSL

Windows install wsl2– WSL may be installed from the command line, as we saw in the guide Install Ubuntu WSL on Windows 10 (read the whole blog for how to install Ubuntu GUI on wsl2). It may also be downloaded as an application directly from the Microsoft store on Windows 11. The most recent version of WSL with all the newest features will be installed if you install WSL2 for Windows 10 from the store.

Preconditions

Before installation, make sure the following conditions are satisfied:

  • You have Windows 11 installed (build 22000 or higher)

  • It is enabled for the Virtual Machine Platform optional feature.

  • Press the Windows key to bring up the Windows menu, then type about into the search box to see the build number, as seen in the following screenshot:

  • To open the System / About page, pick the line that reads "About your PC."

  • There must be an OS build number greater than 22000. If it isn't, this instruction to install wsl2 for Windows 10 won't work. Instead, adhere to the directions here.

  • The Virtual Platform functionality has to be confirmed as the second criterion.

  • Do a Windows feature search.

  • After opening it, please scroll to Virtual Machine Platform in the control panel.

You must restart Windows 11 after installing the Virtual Machine Platform component before installing WSL components and an Ubuntu application.

Installation Of WSL From The Microsoft Store

WSL components may now be downloaded straight from the Microsoft Store in preview form, much like regular Windows programs.

Open the Microsoft Store and look for a Windows subsystem to install WSL2 Windows 10 home the WSL app.

The application page for Windows Subsystem for Linux Preview may be accessed by clicking on the respective item.

To download and wsl2 install the Windows 10 program, click Get.

You can click Open after installation, but nothing will happen because no Linux distribution is set up.

However, suppose you are determined to launch the WSL program without setting up a distribution first. In that case, you will be presented with a clear and concise assistance notice that you must heed to utilize WSL effectively:

Now, you may start the Ubuntu installation.

3. Download Ubuntu

Ubuntu 18.04 LTS and the most recent Ubuntu version, Ubuntu 20.04 LTS, are among the Linux distributions that WSL supports. Open the Microsoft Store app and type "Ubuntu" to locate them.

Select Get after selecting your preferred distribution.

Which version ought I pick?

Three different Ubuntu versions are available on the Microsoft Store:

  • Ubuntu version is, say, Ubuntu 20.04. Upgrades won't be suggested once 22.04 is made public; this will always be 20.04.

  • Ubuntu without a version. This is Ubuntu's most recent LTS version following the first point release. The current version is Ubuntu 20.04. Up to the first point release of Ubuntu, such as 22.04.1, it will continue to be Ubuntu 22.04. Once 22.04.1 is launched, current users will be given the option to update to 22.04.

  • A daily build of Ubuntu's most recent development version is called Ubuntu Preview. Installing it will let you live on the edge, but you shouldn't use it for production since it doesn't undergo the same level of testing as stable versions and might break at any time.

After that, Ubuntu wsl2 installs Windows 10 on your computer.

After installation, you can open the program from the shop or perform a Windows search for Ubuntu.

Also Read: How To Remove Linux And Install

4. Configure Ubuntu

Congratulations, an Ubuntu terminal is now active on your Windows computer!

After the initial setup, you must establish a username and password (this does not need to match your Windows user credentials).

Finally, installing the most recent updates using the following instructions is usually a good idea. Just remember to input your password when required.

sudo apt update

Then

sudo apt full-upgrade

Press Y when prompted.

5. Install And Use A GUI Package

WSLg is pre-enabled in Windows 11 and is available by default. You can launch graphical Linux programs with WSLg.

Type: to see if you have the most recent package listings.

sudo apt update

Then, start with some basic X11 applications:

Sudo apt install x11-apps

To run the eyes, a "follow the mouse" application, type:

Reyes &

The command will be carried out asynchronously thanks to the & at the end of the line. In other words, the order will be executed in the background, and the shell will instantly return to the prompt.

While WSL is initializing the graphics stack, it takes a few seconds for a GUI program to begin for the first time. GUI programs will run considerably more quickly next time.

Keep eyes open and use the following commands to execute calc:

scale

Reyes follows the pointer as you move it over the calculator. This demonstrates how several GUI programs may communicate with one another.

In the Windows taskbar, you'll notice that apps running under WSLg have a little penguin in the bottom right corner of their icons. One method to tell if a program is running on Windows or Ubuntu is through this (besides the window decoration and styling).

You may close your eyes and scalp by clicking the cross icon in the upper right corner of each X program window.

Scale and eyes are pretty simple X Windows programs, but the Linux ecosystem has plenty of options suitable for your needs and is pre-installed on Ubuntu.

In the example that follows, we'll compute numerically using GNU Octave.

Software with a high-level programming language, GNU Octave, is mainly used for numerical computations. Octave assists with running various numerical experiments and solving linear and nonlinear problems numerically in a language mostly MATLAB equivalent. Octave and GNU

It will be used to compute and create a stunning Julia fractal. Instead of reviewing the fractals theory, this exercise aims to utilize Octave to show how WSLg functions.

The first thing is to install the software as we did for x11-apps from the terminal prompt run:

Sudo apt install octave

Then start the application:

octave --GUI &

Don't forget to include the ampersand & at the end of the line to launch the program in the background while keeping the terminal window open.

Copy and paste the following code into a new editor window after clicking the Newscript icon in Octave:

#{

Inspired by the work of Bruno Girin ([Geek Thoughts: Fractals with Octave: Classic Mandelbrot and Julia](http://brunogirin.blogspot.com/2008/12/fractals-with-octave-classic-mandelbrot.html))

Calculate a Julia set

zmin: Minimum value of c

max: Maximum value of c

px: Number of horizontal pixels

niter: Number of iterations

c: A complex number

#}

function M = Julia(zmin, zmax, hpx, niter, c)

%% Number of vertical pixels

vpx=round(hpx*abs(imag(zmax-zmin)/real(zmax-zmin)));

%% Prepare the complex plane

[zRe,zIm]=meshgrid(linspace(real(zmin),real(zmax),hpx),

linspace(imag(zmin),imag(zmax),vpx));

z=zRe+i*zIm;

M=zeros(vpx,px);

%% Generate Julia

for s=1:niter

mask=abs(z)<2>

M(mask)=M(mask)+1;

z(mask)=z(mask).^2+c;

end

M(mask)=0;

end

The Julia set calculation function is contained in this code.

Please save it to a Julia.m file. Since it is a function definition, the file's name must coincide with the function's name.

The new script button will open a second editor window where you may copy and paste the following code:

Jc1=julia(-1.6+1.2i, 1.6-1.2i, 640, 128, -0.75+0.2i);

images(Jc1)

axis off

colormap('default');

This code invokes the Julia.m function. If you wish to investigate the Julia fractal, you may alter the settings afterward.

Please save it to a Julia test.m file.

Finally, click the Save File and Run button.

A Julia fractal is displayed briefly, depending on your hardware and the settings.

Like Octave, this window is shown to the user transparently via WSLg.

6. Enjoy Ubuntu On WSL!

I'm done now! In this article, we've shown you how to install wsl2 on Windows 10, install some packages, install wsl2 Docker and Ubuntu on Windows 11, and launch a graphical application.

Also Read: How To Install Google Classroom In Laptop

Convert Ubuntu On WSL 1 To WSL 2

If you use WSL 1, you can upgrade an existing WSL 1 installation to WSL 2. To convert a current WSL 1 distro to WSL 2, run the following in PowerShell, e.g.,

wsl.exe --set-version Ubuntu 2

It would be best if you replaced 'Ubuntu' with the name of whichever distro your WSL 1 install runs.

How To Install wsl2 For Docker

In this article, I'll go through how to install wsl2 for Docker so that it may function as the backend for Docker Desktop for Windows. I've usually used virtual machines like VMWare or Virtual Box to work with Linux, but I decided to test Docker Desktop and was pleasantly pleased by the results!

Using the setup guidelines, I'll explain how to install Chrome Ubuntu wsl2 before demonstrating how to install wsl2 for Docker. Finally, I present the operation of a container and how Docker Desktop renders it.

Install WSL2 Docker

Without installing a "heavier" virtual machine like Virtual Box, VM Ware, or Hyper-V, you may run a complete Linux environment on your Windows computer using the Windows Subsystem for Linux (WSL). Additionally, Windows 10 install wsl2 offers a way to run Docker (in Linux containers) on a Windows computer. As a requirement for Docker Desktop for Windows, we'll install Chrome Ubuntu wsl2.

Docker Desktop can only be used with WSL 2 on Windows Home systems. Hyper-V is another option on Windows Pro. However, it has since been deprecated. Therefore, WSL 2 is always the better option.

1. Install WSL 1

The first step will be installing WSL 1 and turning on the WSL functionality.

Open PowerShell as Administrator (I hit the Start key, type Powershell, and hit ctrl+shift+enter to open an elevated command prompt). Run the following to enable WSL 1

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

You should see the following:

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

Deployment Image Servicing and Management tool

Version: 10.0.19041.746

Image Version: 10.0.19042.804

Enabling feature(s)

[==========================100.0%==========================]

The operation was completed successfully.

That activates WSL, but we'll also start the WSL2 install in Windows 10, which Docker Desktop can utilize to run the virtual machine it needs to execute containers.

2. Enable The Virtual Machine Feature

You must activate the Virtual Machine capability, available in Windows 10 versions 1903 and higher because wsl2 installed in Windows 10 utilizes a lightweight VM. Run these commands in the same elevated command prompt:

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

You should see something like the following:

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

Deployment Image Servicing and Management tool

Version: 10.0.19041.746

Image Version: 10.0.19042.804

Enabling feature(s)

[==========================100.0%==========================]

The operation was completed successfully.

3. Restart

Restart your computer now to make sure everything is registered correctly.

4. Install The WSL 2 Update

Install Ubuntu in wsl2, the WSL2 Linux kernel update package for x64-based computers.

Restart your computer after installing the WSL 1, and VM features if you see the following problem when attempting to perform the update:

The installer completes relatively quickly, and a confirmation page will ideally appear.

5. Set WSL 2 As Your Default Version

This is an easy step; just run wsl --set-default-version 2 in any PowerShell window:

>wsl --set-default-version 2

For information on key differences with WSL 2, please visit https://aka.ms/wsl2

6. (Optional) Install A Linux Distribution

To utilize Docker Desktop, we don't need to wsl2 install Docker – a Linux distribution, but if you want to shell into Linux directly, you'll need to do so. Direct installation of distribution is possible through the Microsoft Store.

It would be best to create a username and password before launching the distribution for the first time. The wsl2 install docker will unpack and install itself.

7. (Optional) Add To Windows Terminal

You can set Windows Terminal to open your WSL distribution if you use it, which you really ought to do. Resetting the settings.json file is the most straightforward approach to accomplish this. Deleting the file's contents will cause the Terminal to automatically re-fill it with the default settings, including a WSL tab.

Naturally, you won't want to lose your customized settings, so create a backup of the file's contents first!

You can rapidly launch your WSL instance from Windows Terminal by adding WSL to your profile list, which you can find in the profiles list.

Now that the required beginning for Docker Desktop has been covered let's go on to the main meal.

Also Read: How To Install Anti-Virus In Laptop

Also Read: How To Install GTA 5 On Laptop

Conclusion:

The best way to install wsl2 Ubuntu on Windows 10. With some improvements, Windows Subsystem for Linux 2 is now accessible on Windows 10 and 11 and may be installed and used in this manner. WSL2 (Windows Subsystem for Linux version 2) replaces WSL and allows native Linux on top of Windows 10. install podman on wsl2 Ubuntu for Windows 10 Microsoft has simplified the installation of the WSL on Windows 10 2004 and later editions (including versions 21H2 and 21H1) by condensing it to a single command that downloads and wsl2 install Linux all essential components, including Ubuntu Linux by default and the virtual machine platform. Enter the following command and press Enter to install wsl2 ubuntu Windows 10: install wsl2 windows 11. Restart your machine to finish installing WSL on Windows 10. 

Once you've followed the instructions in the letter, the required Linux components will automatically install in wsl2, the most recent release of the Ubuntu Linux system. On Windows 10, use the command given below and press Enter to install Docker in Ubuntu wsl2 with a particular distribution. WSL – Install DISTRO-NAME Don't forget to change "DISTRO-NAME" in the command to the name of the distribution you want to install, such as Debian. 

Once you've followed the instructions to the letter, the Windows Subsystem for Linux 2 components will install docker-compose wsl2 alongside your chosen Linux distribution. Type the following command to update the WSL kernel: wsl - update. After completing the steps, if an update is available, it will download and install Docker on wsl2 ubuntu 20.04 on the device. Setting the Windows Subsystem for Linux 2 (install WSL2 on different drives) as the new default for incoming distribution installation is part of the process, which also involves turning on WSL1, the Virtual Machine Platform, upgrading current distributions, and depending on WSL1. On Windows 11, we'll also go through how to upgrade the Linux kernel.

Frequently Asked Questions

Laptop Repair | Computer Repair | Printer Repair

Sam may enable WSL (and WSL 2 to boost speed and performance), and then use a local (on the laptop) instance of the Linux operating system Ubuntu with whatever Bash commands and tools they like.

WSL2 Linux files are accessible through the network path "wsl$". In any file open dialog or the address bar in File Explorer, type it in. The username you specified during installation is represented here by . It's advisable to configure Windows Terminal to use this as the distro's default starting folder.

Run "wsl -install" in Command Prompt as an administrator to install WSL2 on Windows 10. The Ubuntu Linux distribution and all of the WSL2 components will be installed using the command. Run "wsl -install -d DISTRO-NAME" to install a specific distro. The "wsl -update" command should be used to update the WSL2 kernel.

All Desktop SKUs where WSL is offered, including Windows 10 Home and Windows 11 Home, support WSL 2. The most recent version of WSL virtualizes using Hyper-V architecture. The optional component "Virtual Machine Platform" will include this architecture.

Depending on the application you're using and how it communicates with the file system, you may notice a performance improvement. When unzipping a tarball, the early versions of WSL 2 perform up to 20 times quicker than WSL 1, and they perform 2 to 5 times faster when using git clone, npm install, and cmake on various projects.

The usage of a real Linux kernel inside a managed VM, support for complete system call compatibility, and performance between the Linux and Windows operating systems are the main changes between WSL 1 and WSL 2.
+91-97171 50098