Anandraj Jagadeesan, a Managing Consultant with Altis in Sydney, shares his experience of installing Ubuntu Bash in a Windows 10 environment.
PLEASE NOTE: Since this blog post was written, Microsoft has made improvements and has released the WSL2 version and installation steps and system requirements have changed. Click Here for updated installation steps.
For the last few years as a big data developer I have been using a Mac at work and a Linux desktop for my personal needs. I recently started using a Windows laptop at work and I was initially concerned about how to access my favourite development tools, until I came across the native Bash Shell for Windows and the option to access Docker from the same environment. This provides the ability to run a complete set of Ubuntu tools and utilities (e.g. Docker, Git, Python, Spark and all the data munging Linux commands) natively on Windows 10.
Microsoft has brought “native” Linux capabilities to Windows 10 by allowing you to install Ubuntu Bash. Microsoft has achieved this by building a new infrastructure into Windows called the Windows Sub-system for Linux (WSL) and worked with Canonical to run Ubuntu userland on top of this infrastructure. This means developers using Windows machines will have access to the complete Ubuntu command line toolset (vi, grep, awk, sed, etc..) and can install command line tools available for Ubuntu using “apt-get install”. This avoids clunky workarounds like Virtual Machines and Cygwin that can slow down your machine. So, the bottom line is that Windows users can now get the same Linux experience that they get in a Mac or Linux desktop.
Before you get too excited, you need to check that you have a version of Windows 10 that supports Ubuntu Bash. At a minimum, it must be Version 1607 (Anniversary Update). You can check this by opening the “About my PC” option from Windows Start and check that the version is “1607” or above. If Yes, you are good to go, otherwise you’ll need to update to the latest version. Don’t worry if you have Home edition as developer mode is available in Home edition as well.
Enough of the background, let’s get to the actual fun stuff of getting it to work by following the steps below:
- Open Settings app and go to Update & Security -> For Developers and choose the “Developer Mode” radio button.
- Then go to the Control Panel -> Programs and click “Turn Windows feature on or off”. Enable “Windows Subsystem for Linux(Beta)”. When you click OK, you will be prompted to reboot. Click “Restart Now” to reboot your PC.
- After rebooting, head to Start and search for “bash”. Run the “bash.exe” file. When you run it for first time, you’ll need to accept the terms of service as “Bash on Ubuntu for Windows” will be downloaded from the Windows Store. You will be asked for a Username and Password for the Ubuntu environment. Please store them somewhere as the password is required to run commands as sudo.
After completing this process, you will now have a full Ubuntu command-line and can use Ubuntu’s apt-get command to install software from Ubuntu’s repositories. In theory all binaries should work, but beware that this facility is still in beta and not every application may work flawlessly. Also note that graphical applications and desktops are not supported, and running server applications is not recommended.
You can become “root” user and have full system access, like the “Administrator” user on Windows. Your Windows file system is located at /mnt/c in the Bash shell environment.
Watch this space for the next blog in the series that will look at how to get Docker & Spark working from Windows 10 Ubuntu Bash shell.