Skip to content

How to set up a Linux terminal environment on Windows 10 with Windows Subsystem for Linux (WSL)

Using Linux via WSL gives Windows users a full Linux terminal experience. Windows users can install Ubuntu for easy ssh key generation and command line access to the ScienceCloud and ScienceCluster.

Note

This guide requires Windows Admin access in order to change system settings and install new software.

Note

Although technically possible to support graphical applications and desktops (see instructions below), WSL is not intended for this purpose.

Step-by-step guide

The basic steps for installing Ubuntu on Windows 10 are outlined here. Much of the content on this page is taken from Ubuntu's installation guide: https://ubuntu.com/wsl. You can also read more from Microsoft's documentation page.

Enable WSL on Windows 10

  1. Start PowerShell as an Administrator

powershell screenshot

  1. Run the following command
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  1. Restart your computer when prompted

Download Ubuntu for WSL from the Microsoft Store

  1. https://www.microsoft.com/en-us/p/ubuntu/9nblggh4msv6

download ubuntu

  1. If you don't have access to the Microsoft store, you can manually download Linux distributions for WSL.

  2. From the PowerShell, run this command: (replace app_name.appx with the name and location of the Linux distribution you downloaded). Find more details here.

Add-AppxPackage .\app_name.appx

Run Ubuntu

  1. Just like any app, you can launch Ubuntu from the Start Menu

run ubuntu screenshot

Set up Ubuntu

  1. The one-time installation process will take a few minutes.

  2. You will need to create a user and password. (You will need the password when running local admin commands or installing/updating packages.)

set up ubuntu screenshot

Generate SSH key

To connect to a ScienceCloud instance, you will need to generate an SSH key that securely identifies your user to the remote server.

Using Ubuntu with WSL, follow the Linux instructions from our guide: Training Handout or generic steps from Ubuntu on WSL.

Graphical User Interface

If you would like to generate a graphical user interface (GUI) through WSL from an application running on a ScienceCloud instance, this functionality can also be set up via the following directions.

  1. Download and install an X server application on your Windows machine. Options include Xming, Cygwin X, and vcXsrv. Note: at the time of this writing, Xming appears to require little to no setup once installed. Therefore, consider this as your first option.

  2. Once the X server application is installed, return to your WSL command line and download graphics applications using the following code:

    sudo apt-get install x11-apps
    
  3. To test the functionality of these applications, run:
    export DISPLAY=:0
    
    Then run the following command:
    xeyes
    

Note

xeyes is a simple application that helps you verify the graphics applications are running. You should see a pair of cartoon eyes following your cursor around the screen.

Provided everything has been set up correctly, you can now add the -X flag to your ssh command when connecting to your ScienceCloud instance. In other words ssh -X <username>@<instance_ip_address>


Last update: December 12, 2022