Windows Subsystem for Linux WSL2
As a developer, you always wanted to have Ubuntu running on your machine but then you either end up installing it as dual boot or as a Virtualbox after spending lot of time. What if you get Ubuntu as inbuilt application inside Windows10 itself.
This article will show you how to install Ubuntu on windows 10 machine using Windows subsystem for Linux.
It is advised to use WSL 2 to have better performance and support for most of Linux features. WSL 2 is a new version of the architecture in WSL that changes how Linux distros interact with Windows. WSL 2 has the primary goals of increasing file system performance and adding full system call compatibility. Each Linux distro can run as a WSL 1, or a WSL 2 distro and can be switched between at any time. WSL 2 is a major overhaul of the underlying architecture and uses virtualization technology and a Linux kernel to enable its new features.
Follow these pre-requisite steps to ensure smooth running of linux on WSL2 specially for running docker successfully on WSL2
Step 1. Windows 10 (Build 18932 or higher). To check the OS Build version WinKey + R, run command “winver”
Step 2. You can get the Build#18932 by registering for windows insider program and then check latest windows updates on your machine
Step 3. Enable WSL on your machine( Windows10 ) and then run following command as administrator on PowerShell command to always use WSL2 on your machine
PS> wsl --set-default-version 2
Step 4. Now you are ready to install Linux distro on your machine. Install Ubuntu on Windows 10 WSL using these instructions
Step 5. You need to start the docker explicitly with
PS> sudo /etc/init.d/docker start
Step 5. To verify everything is fine after installation; run the following command on Powershell. If it shows below output, that means Ubuntu-18.04 is running on WSL 2
PS> wsl -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 2
If result of the above step shows version 2 of WSL running on your machine that means you are all set. You can now launch Ubuntu from start menu. I’ve installed docker on Ubuntu 18.04 version. It runs perfectly fine.
Originally published at https://scriptjunction.com/linux/windows-subsystem-for-linux/.