Enable Linux subsystem on Windows

We need to enable Windows Subsystem for Linux (Beta) which is basically Ubuntu linux on Windows.

1. Before installing the Linux Subsystem, you have to have:

  • Windows 10 (Anniversary update or later version)
    64-bit installation (can’t run on 32-bit systems)

2. Go to Windows Settings and click on pushbutton to Enable developer mode. It may take 30min or so to install packages. It failed once and retry was successful.

3. Next go to Programs and Features->Turn Windows features on or off. Click the Windows Subsystem for Linux (Beta). Go ahead and reboot if it asks.

Alternatively you can Enable the “Windows Subsystem for Linux” optional feature from command line:

  1. Open Windows PowerShell as Administrator and run:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

4. Fall Creators Update and later: Install from the Microsoft Store as given in the instructions in https://docs.microsoft.com/en-us/windows/wsl/install-win10

Open the Microsoft Store and choose your favorite Linux distribution.
Here are links directly to the store installers:

After Launch of the install it will take about 30min and give you a prompt as below:

Installing, this may take a few minutes…
Installation successful!
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: root

Enter new Unix password:

Retype new UNIX password:
passwd: password updated successfully
Default UNIX user set to: root
root@:~#

—————————————————————————————–

Note: If using earlier version of Windows 10 then after the reboot open a Windows command prompt and type bash and type “y” to continue. Chose root as the initial linux userid when prompted.

Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\>bash
— Beta feature —
This will install Ubuntu on Windows, distributed by Canonical
and licensed under its terms available here:
https://aka.ms/uowterms

Type “y” to continue: y
Downloading from the Windows Store… 100%
Extracting filesystem, this will take a few minutes…
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: root
Found UNIX user: root
Installation successful!
The environment will start momentarily…
Documentation is available at: https://aka.ms/wsldocs
root@localhost:/mnt/c/Users/#

—————————————————————————————————

5. Bash on Ubuntu on Windows app will show up in Windows Start. Click on it. You will get a bash terminal and Ubuntu will be up and running now.

6. Check the Linux version:

$ lsb_release -a

No LSB modules are available.

Distributor ID: Ubuntu

Description: Ubuntu 16.04.2 LTS

Release: 16.04

Codename: xenial

Note the windows drives are mounted in the Subsystem inside the /mnt directory

cd into your Windows user’s Documents directory:

$cd /mnt/c/Users/youruserid/Documents/

You will now have a running Ubuntu on Windows where you can install any Ubuntu packages. And it takes only couple of GB of space and little bit of cpu so wont slow down your laptop like running a Linux VM on Windows.

You can access this Ubuntu server on Windows using Mobaxterm terminal as below:

Download Mobaxterm if you dont have it and install it and must be version 10.5 or higher. Click on the Session icon and then click on Shell icon. Then select Terminal shell dropdown as Ubuntu Bash (WSL). Select any Startup directory such as c:\ and click ok. Thats all you should be able to see a terminal session on your Ubuntu server to work with just like Putty. For more info see the blog:   https://blog.mobatek.net/post/mobaxterm-new-release-9.3/

 

 

 

 

 

 

Advertisements

One thought on “Enable Linux subsystem on Windows

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s