How to Install Windows Subsystem for Linux 2 on windows 10 PC/Laptop
- 1 How to Install Windows Subsystem for Linux 2 on windows 10 PC/Laptop
- 2 How to Install Windows Subsystem For Linux on Windows 10 (Graphical Method)
- 3 How to Install the Windows Subsystem for Linux using Windows 10(Command-Line)
- 4 How to Install Linux Distros on Windows 10?
- 5 Install WSL2: How to Change WSL to WSL2?
Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables (in ELF format) natively on Windows 10 and Windows Server 2019. In May 2019, WSL 2 was announced, introducing important changes such as a real Linux kernel, through a subset of Hyper-V features. Since June 2019, WSL 2 is available to the Windows 10 customers through the Windows Insider program, including the Home edition.
On Windows 10, the Windows Subsystem for Linux (WSL) is a feature that creates a lightweight environment that allows you to install and run supported versions of Linux (such as Ubuntu, OpenSuse, Debian, etc.) without the complexity of setting up a virtual machine or different computer. Although you won’t get a graphical interface, this approach enables developers and network administrators to use a long list of command tools and services (such as vim, tmux, andemacs, sshd, Apache, and MySQL), and run Bash shell scripts written in Python, Ruby, C#, F#, and many others using a command console.
There are two methods of installing Linux on your Windows 10
- Graphical Method
- Command-line Method
How to Install Windows Subsystem For Linux on Windows 10 (Graphical Method)
- Internet connection.
- Windows 10 Anniversary update 1607 for WSL.
- Windows 10 insider build 18917 or later for WSL2.
- Hyper-V Service enabled Device.
Installing WSL using the Settings app and Control Panel would be the method of choice for most users, as that is the easiest. Here are the steps to Install WSL in Windows 10:
- On your Windows 10 machine, Click Start and navigate to Control Panel.
- Now, Select the Programs Category.
- Under Programs and Features, Click on Turn Windows Features on or off.
Alternatively, you can open up the Settings app on Windows 10 and then navigate to Apps > Programs and Features > Turn Windows features on or off.
- Now, the Windows Features windows will pop-up. Here, you can turn on and off Windows 10 Features using checkboxes.
- In the list of checkboxes available, scroll down to find the Windows Subsystem For Linux option.
- Tick the Checkbox corresponding to Windows Subsystem.
- Click OK to install the WSL for Windows 10.
- Finally, click the Restart Now button to apply the changes made and finish the installation of WSL.
How to Install the Windows Subsystem for Linux using Windows 10(Command-Line)
To install Windows Subsystem for Linux on Windows 10 by command-line PowerShell
- Search for Powershell in the Start menu.
- Before opening the app, Right-click, and choose to run the application as an administrator.
- Enter the following command:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- After execution of the command, PowerShell will ask you to restart your machine to apply the changes.
- So, type the letter “Y” to complete the process and confirm the restart.
That’s it. After the restart, you now have a working Windows Subsystem for Linux set for some action.
How to Install Linux Distros on Windows 10?
Finally, after installing the Windows Subsystem for Linux, we can now proceed to the installation of the Linux distributions available in the Windows store.
To install the Linux Distro, you want in Windows 10,
- Click Start and then select the Microsoft Store.
- Using the search box available in the Microsoft Store, pick your favorite distribution to install on Windows 10.
- Also, if you want to see the whole list of available Linux distributions, you can type in Linux and then go through the search results.
- After selecting your distro of choice, Click Install or Get.
(Now, if you haven’t already signed in with your Microsoft account, it will ask you to do so. But, you can also close the pop-up window in case you don’t want to sign in to your account at the moment.)
So now, wait a few seconds before the download and installation process finishes, and you’ll have your Linux distribution installed on Windows 10 and ready for use. Furthermore, the distro will be available directly in the start menu itself in the form of a standard everyday application.
When starting the Linux Distribution for the first time, a brief setup process will take place. Basically, it will ask for the username and password you want to set for the Linux environment.
Install WSL2: How to Change WSL to WSL2?
After you have successfully installed your Linux distribution along with the WSL feature, you must change Windows Subsystem for the Linux version of your Linux Distro to WSL2. Until you manually change the version, it will remain to run in the WSL environment.
So, to set a Linux distribution to the WSL2 version,
- Open up the PowerShell as an Administrator.
- First of all, check the name of the installed Linux distribution. To do this, run the command.
- Now, after you noted the name of the distribution, run the command
wsl --set-version <distro> 2.
Make sure that you replace the codespace “<distro>” with the actual name of the installed distribution.
- Moreover, you can use the command below to set WSL2 as the default architecture for all installations.
wsl --set-default-version 2