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¶
- Start PowerShell as an Administrator
- Run the following command
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- Restart your computer when prompted
Download Ubuntu for WSL from the Microsoft Store¶
-
If you don't have access to the Microsoft store, you can manually download Linux distributions for WSL.
-
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¶
- Just like any app, you can launch Ubuntu from the Start Menu
Set up Ubuntu¶
-
The one-time installation process will take a few minutes.
-
You will need to create a user and password. (You will need the password when running local admin commands or installing/updating packages.)
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.
Useful links for ssh keys, accessing files, etc¶
-
Access the Windows file system from Linux. The
C:\
drive is available at/mnt/c/
-
WSL2 is now generally available. You may find some performance improvements, but it is supported only by newer builds of Windows 10.
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.
-
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.
-
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
- To test the functionality of these applications, run: Then run the following command:
export DISPLAY=:0
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>