4.7 Windows Subsystem for Linux (WSL)
The Windows Subsystem for Linux (WSL) is available as a feature on Windows 10. Out-of-the-box WSL supports Ubuntu running within Windows. This is the simplest option if you have Windows 10 (1709 or later) installed (see Settings -> System -> About). It also requires the installation of XMing or VcXsrv. Microsoft also released WSLv2 in May 2020 to incorporate the Linux kernel directly within Windows, so as to deliver significant performance gains and support more applications. However WSLv2 is not currently recommended due to its limited access to Windows file systems from Ubuntu.
To get started
- Install XMing on Windows (download, run, and choose the defaults for the installation).
- Go to “Turn Windows Features On or Off” (Control Panel -> Programs -> Programs and Features), tick on the box ‘Windows Subsystem for Linux’ to install WSL and reboot.
- Go to Microsoft Store and search for the latest Ubuntu distribution to install.
- Launch Ubuntu from the Start menu or else type the command “ubuntu” in the Powershell.
- For GUI applications run the command $ export DISPLAY=:0 in the Ubuntu terminal window.
Ubuntu is readily available on Microsoft’s Windows 10 where the Windows Subsystem for Linux (WSL) supports Ubuntu out of the box. This is the simplest option for installing Ubuntu if you already have Windows 10 (1709 or later) installed (see Settings\(\rightarrow\)System\(\rightarrow\)About).
Microsoft also released WSLv2 in May 2020 to incorporate the Linux kernel directly within Windows, so as to deliver significant performance gains and support more applications.
The steps to install WSL and then Ubuntu on a Windows 10 system are provided by Microsoft and summarised here.
Install XMing on Windows (download, run, and choose the defaults for the installation).
Go to Turn Windows Features On or Off (Control Panel\(\rightarrow\)Programs\(\rightarrow\)Programs and Features), tick on the box Windows Subsystem for Linux to install WSL and reboot. The option can also be enabled from the PowerShell:
> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Go to Microsoft Store and search for the latest Ubuntu distribution and install it. It is a free application. Once you have obtained the app click the Launch button in the Microsoft Store. This will install and configure the Ubuntu distribution, including asking you to create a new username.
Launch Ubuntu from the Start menu or else type the command
ubuntuin the Powershell.
For GUI applications run the command
$ export DISPLAY=:0in the Ubuntu terminal window.
Once you get to a shell prompt enter the following command to update the operating system:
$ sudo apt update && sudo apt upgrade
$ sudo apt install python3-pip $ pip3 install wajig $ wajig update $ wajig distupgrade
Given that the system has just been upgraded the distupgrade here may report that there is nothing to be done.
For Ubuntu 18.04 the system can be started from the PowerShell with:
Ubuntu is now running within Windows. The following commands then illustrate a GUI based command demonstrating an animated plot.
$ export DISPLAY=:0 $ pip3 install mlhub $ ml configure $ ml install animate $ ml configure animate $ ml demo animate
Further resources are available in other sections in this chapter, and from Simon Zhao.
Your donation will support ongoing availability and give you access to the PDF version of the book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.