This tutorial to know how to install the Windows Subsystem for Linux or WSL2 on Windows10
We must be running Windows 10.
Step
Install Chocolatey
Open PowerShell as administrator, search for Windows Powershell in the Start menu, right click it and select Run as administrator.
Now we run following commands to install Chocolatey.
Set-ExecutionPolicy Bypass -Scope Process
-Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol
-bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Close and reopen the PowerShell window, so it will refresh the windows PATH environment variable and the Choco command will be available.
Now Configure Chocolatey to suppress any annoying prompts. Run the following commands in PowerShell as administrator.
Chocolatey is a package manager for Windows and we will use it to assist in the installation of some other programs. We always need to be in an elevated terminal with administrator privileges' when calling Choco be it PowerShell or command prompt.
Chocolatey will automatically installs the packages if required software are not installed already.
Run the following command in PowerShell as administrator. Gsudo is a tool which enables us to run commands with elevated permissions much like sudo command in Linux.
As now we have gsudo, we don't need to open as administrator anymore.
Let's install the Windows Terminal. Run following commands. Once we have windows Terminal installed, we can open any of different shells as tabs and then run the commands through it.
These terminals could be PowerShell or Shell on the Ubuntu.
After this enabled the Hyper-V at the Windows initialization. Run the following commands in PowerShell and Restart the windows machine. This is very important step in WSL2 installation.
Now Install Ubuntu 20.04 LTS WSL2 distribution.
Run the following three commands one by one in PowerShell. We need to make sure Ubuntu 20.04 is set as our default distro in WSL.
choco upgrade wsl2 --force
choco upgrade wsl-ubuntu-2004
wsl --set-default Ubuntu-20.04
Now Open the Ubuntu 20.04 LTS from the Start Menu and follow the instructions on the screen to complete the post installation steps. We should provide a username and password that we would want.
Now let's verify our Ubuntu Sub Linux system don't have network connectivity issue. Our Linux box must be able to ping the public domain or IPaddress like google.com , yahoo.com. We need to also verify that we are able to ping the localhost machine or not. This will be very important if we want deployed services in the Linux box as well as on windows box must be able to communicate without any issue.
There is one common issue I have found that users are not able to share the files between the windows and sublinux system. They tried multiple things like mount or unmount. Watch carefully, explorer.exe and explorer.exe . will be very helpful to share the files between the two machines. Even, I am showing in this tutorial that I have created a file using the vi editor in Linux box but those can be seen in the windows box.
If you find the tutorial is helpful, please consider to subscribe the YouTube Panda Tech Tips Channel. Keep liking and commenting on video. Thank you for watching.
----------------------------------------------------------------------
Happy by MBB / mbbofficial
Creative Commons ・Attribution-ShareAlike 3.0 Unported ・CC BY-SA 3.0
Free Download / Stream: https://bit.ly/Happy-MBB
Music promoted by Audio Library • Happy – MBB (No Copyright Music)
-----------------------------------------------------------------------
#pandaTechtips, #tutorial, #WSL2