Setting Up Ubuntu with Windows WSL


What is Windows Subsystem for Linux (WSL)?

WSL implements the Linux kernel interface and hence allows for running Linux based systems and apps directly on the Windows machine. There's no need for VirtualBox setup or DualBoot so it's more convenient for developers to use both Windows and Linux systems at the same time.

It's defenitely far from perfect but it's stable enough to be used on the development machines.

Thanks to WSL we can use tools designed for Linux while working on Windows machine.

Why even bother?

I know Linux is the best! But ...

As much as I love Linux, there are situations where you need to use Windows (e.g. design, video editing, etc.) In the past there were only two options, use VirtualBox or DualBoot setup. Both of these approaches have its pros and cons but one is sure, any of them was far from ideal. VirtualBox is a resource intensive monster that take a lot of host resources just to run the box. DualBoot on the other side is better on the resource management but it requires you to reboot machine to switch between systems.

Additionally laptop users know that many manufacturers don't care about Linux. Unfortunately it's always a pain to find compatybile drivers and setup the machine to enable all the features available to Windows users.

How to set it up

Enable WSL

First of all, you need to run the latest 64-bit Windows 10 and turn on the
WSL
by enabling the option in the Windows control panel.
Control Panel > Programs > Turn Windows Features on or off → Windows Subsystem for Linux
Windows control panel WSL

To enable the WSL full system restart is required. After selecting the option, prompt with request to restart computer will show up.

Install Linux

Open Microsoft Store and search for "linux". Select your favourite distro and install.

Windows store - Linux
You can install multiple Linux distributions on the same machine. Note if you're just starting with Linux I would recommend to install Ubuntu or Debian.

When installation is done, you should be able to see new app installed. During the first run it will ask you for the user related details like default username and password.

Windows control panel Ubuntu

That's it! You're now able to access your Windows system in the Linux bash console!

  
    $ ls -la /mnt/
    drwxrwxrwx  1 mr-coffee mr-coffee   4096 Mar 18 20:53 c
  

Final touches

Personally I'm really picky about the look of my console. I got used to how it looks in Ubuntu. So, there is few more tips to style the console base on the Ubuntu.

Update the hostname

WSL updates the /etc/hosts and hostname each time the Linux shell is restarted. This is based on the Windows machine hostname. So the simplest solution is to update the Windows machine hostname. Settings > System > About > Rename this PC

Update font family and colors

Download the Ubuntu font family, unpack and install UbuntuMono-R.ttf by clicking on the font and Install when font opens.

Follow the tutorial for adding fonts to the console here.
After your new font has been added, you can change the font to the newly added, font color to white and background to rgb(48, 10, 36) by clicking on the "System icon" > Properties in the left top corner of the shell window.
WSL Ubuntu shell styling