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.
References:
https://www.linux.com/news/bash-windows-what-does-it-mean
https://www.windowscentral.com/how-install-bash-shell-command-line-windows-10
https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10
https://support.microsoft.com/en-ph/help/13443/windows-which-operating-system
8 Responses
I have successfully installed and using Ubuntu on my windows 10,
Main issue is accessing files as we do in normal Ubuntu/Linux server using sftp, I am not able to do that, how is that possible any idea?
The third step didn’t install it for me.
I did this to finish the process:
Ubuntu can be installed from the Microsoft Store:
Use the Start menu to launch the Microsoft Store application.
Search for Ubuntu and select the first result, ‘Ubuntu’, published by Canonical Group Limited.
Click on the Install button.
Ubuntu will be downloaded and installed automatically. Progress will be reported within the Microsoft Store application.
and it seems working properly.
I tried installing from Microsoft store like you said but it keeps saying “ERROR”
This worked for me too. Thanks!
thank you for the tips. It solved my issue too.
Step 2 is not displaying on my turn program on or off list and so i am stuck there at the moment
Hi Huey,
Unfortunately, WSL feature is no longer available in Beta. So, You must be able to see “Windows Subsystem for Linux” as below.
https://altis.com.au/wp-content/uploads/sites/3/2020/08/windows-linux.png
I did install your Ubuntu, but it unfortunately failed for me. I need to compile and run the ‘Computer Programs in Seismology Package’ under Ubuntu. I also did apt-get installed the gcc, gfortran and the rest of the compilers for me. But when it came to compileing the pack ‘./C’ command throws out an error:
./C: 5: ./C Syntax error: “(” unexpected
Even though I have the latest version of the program pack it fails. Should I dump this Ubuntu18.04 of Windows and go on with a virtual box?? Any answer would be appreciated- thanks.