By using WSL (Windows Subsystem for Linux) we can run full-fledged Linux CLI (command line interface) without ever installing Linux in either Virtual Machine or a Dual-boot system.
Also, WSL can leverage full hardware and software support as it is running directly on hardware rather than a virtual machine in case of Virtual Box or VMware Workstation.
Please note that we cannot run any kind of Linux GUI application, as WSL does not support X server, Wayland, or any other kind of Linux display servers.
- Windows 10 (1607 +) 64-bit version (32 bit is not supported by WSL)
- Working Internet Connection
Checking the pre-requisites
To check which version of Windows you are running, open settings
And then about. On the right pane, you can see which version of Windows you are running.
Enabling Support for WSL
There are two ways to enable WSL support for Windows, either using the command line or using the GUI method. Here I am going to describe both methods step-by-step using screenshots.
Method – 1: Using Command Line (Recommended)
Open up PowerShell with Admin permission, using the start menu (Start > PowerShell (Right click) > Run as Administrator)
Or use the keyboard shortcut, Win + X followed by a
Once the PowerShell opens up, type the command:
> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Once we type the command and hit enter, it will ask to reboot the computer. Please follow the instruction as it is crucial that we reboot in order to complete the process.
Method – 2: Using GUI
Go to Start and search for “Turn Windows features on or off”
In the subsequent screen, select “Windows Subsystem for Linux”, click OK and restart.
Once we restart the computer, we are ready to install Linux on our Windows machine.
Open up the Windows Store and search for Ubuntu, as we will be installing Ubuntu.
Notice here that, there are multiple Ubuntu results available. Choose either “Ubuntu” or “Ubuntu 18.04 LTS” or whichever the latest one is. One thing to remember here is that if you choose Ubuntu, Windows store will automatically update the Linux when a new version comes out, i.e, from Ubuntu LTS 18.04 to 20.04. But in case of Ubuntu 18.04, Windows store will not update it even when a newer version is available until you specify.
I will be going with “Ubuntu 18.04 LTS” as I prefer to update the distribution only when I need to.
Once it finished the installation, we will be able to see the entry of Ubuntu in the start menu.
When launched for the first time it will install the required files (see the screenshot below):
Ubuntu installation on windows
At this stage, it may happen that it will wait for you to press a key, so keep hitting Enter or Backspace key every 15 seconds or so.
During the installation, it will ask to provide the credentials. After providing credentials we will be successfully logged in.
Once we have successfully installed the WSL, we should update the Ubuntu system.
Issue the below commands inside your Ubuntu command prompt to fully update the system.
Once the update is finished, we are ready to test it out.
Accessing Windows Files
Now that we have successfully installed WSL, we need a way through which we can access the Windows files from WSL itself.
The Windows drives – C:\, D:\, etc., – are mounted at /mnt/<drive_letter>. For example, D:\ drive of the Windows system will be mounted to “/mnt/d”. Check the below snapshot.
If there is ever any kind of permission error, just make sure that you are running the command as sudo user.
If you like the content, we would appreciate your support by buying us a coffe. Thank you so much for your visit and support.