Installing Windows Subsystem for Linux (WSL) Draft

Posted by Geoff, Published: 5 years, 6 months ago (Updated: 5 years, 3 months ago)

Before you can continue with MountainSort, you must first download the Windows Subsystem for Linux (WSL). The procedure that I used to download Ubuntu comes from the reference below. Keep in mind there are ways to download Ubuntu without the Microsoft Store1, but I feel as though this is the most simple method.

Installation

  1. Open PowerShell as Administrator (search "powershell" in the search bar, then right click on "Windows PowerShell" and select "Run as administrator".)
  2. Next you must use the following code in the PowerShell to enable the WSL option:

    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  3. It will likely ask if you want to restart to computer to complete the operation, go ahead and restart the computer by typing "Y", then pressing the Enter button.
  4. Open up the Microsoft Store, and search for Ubuntu. You will likely see a few options for various versions. If you prefer a specific version feel free to install that App and follow the directions given in the description. Otherwise, I suggest choosing the one that only says "Ubuntu", as it will download the latest stable version of Ubuntu. Note: you might be required to update your Windows prior to downloading Ubuntu.
  5. If you choose the "Ubuntu" option then you will likely have to simply type ubuntu in the command prompt (cmd.exe), and it will launch the Ubuntu shell.
    • If you choose an option with a specific version number (such as Ubuntu 18.04), then you will likely need to include the version number for example:
      ubuntu1804
  6. Upon launching the WSL for the first time, the terminal will ask that you provide a username and password for this Ubuntu installation.
  7. I suggest updating your root password by using the following command in the Ubuntu terminal:
    sudo -i passwd​
  8. I suggest updating all the Ubuntu packages using the following command in the Ubuntu terminal:
    sudo apt-get update && sudo apt-get -y upgrade​
  9. Now you have successfully installed WSL onto your Windows 10, it is time to celebrate!

Configuring WSL to Run Graphical Programs

WSL is not designed to support graphical programs out of the box. If you want to utilize any graphics based applications (i.e. Qt-MountainView) then you will need to configure WSL so that it can run graphical programs.  The solution that I found is to use an X server (on your Windows 10 machine).

  1. There are many X servers that can run on Windows, however the one that i used is Xming. So the first step would be to download Xming2 (or your preferred X server).
  2. Launch Xming, Xming will need to run in the background for your WSL graphical programs to work. Likely you will need to start Xming every time your PC restarts, although you can configure your Windows machine to start Xming on restart.
  3. Now we must configure the X server from the WSL side. Begin by editing the ~/.bashrc file. This file is executed before every launch of the WSL. We will edit the file using the following command from the WSL terminal:
    sudo nano ~/.bashrc​
  4. Add the following text to a new line at the bottom of the ~/.bashrc file:
    export DISPLAY=:0​
  5. Now save the file by pressing Ctrl+X, confirm by pressing the Y key, and finish by pressing Enter.

  6. Relaunch the WSL to have the ability to view graphical programs.

References

  1. Windows Subsystem for Linux Installation Instructions: https://docs.microsoft.com/en-us/windows/wsl/install-win10
  2. XMing X Download: https://sourceforge.net/projects/xming/files/latest/download

Comments

Post Comment