Skip to content

Setting Up Unix For Windows

Javier Tham edited this page Oct 12, 2021 · 2 revisions

Setting Up Unix Computing Environment on Windows 10 with WSL

Credits: Prof Henry Chia And Prof Ooi Wei Tsang


WSL, or Windows Subsystem for Linux, is a subsystem that allows users to run a Unix computing environment within Windows 10. This is the recommended method for having a local Unix computing environment for your Windows 10 machine, for the purpose of CS1010, CS2030, CS2030S, and CS2040.


Running Powershell to install Ubuntu

  1. Search Powershell and run as administrator

  2. Run the following command which helps you to enable WSL on your windows Machine

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  1. As WSL Version 2 is unstable at the moment, we will default to the usage of WSL Version 1 using the following command:
wsl --set-default-version 1
  1. Following which, we can using the web to invoke a request to download the necessary appx file to download the package for wsl-ubuntu
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile C:\Ubuntu.appx -UseBasicParsing
  1. Once the installation is complete, run the following command to install this package
Add-AppxPackage C:\Ubuntu.appx

Launching WSL

To launch WSL, you can hit ⊞ Win + R and type in Ubuntu followed by enter. This should bring up the Unix command-line interface for you to interact with the Unix computing environment.

if there's an error "Windows cannot find 'Ubuntu'", you can try running WSL by hitting ⊞ Win + R and typing in wsl followed by enter. You will be in the user home directory, navigate to other directories with the cd command. eg. cd Desktop/CS2030/ View other directories with the ls command.

Getting ready to install tools

Ubuntu comes with apt as the package manager, which is a convenient way to list, search, install, update, and uninstall software and libraries in WSL.

After you have set up WSL, run the following:

sudo apt update

What it does:

  • apt is a command to install, upgrade, search, and uninstall software and other packages in Ubuntu.
  • apt update asks apt to obtain the latest list of available packages from the Internet.
  • sudo performs apt update with a super-user's level permission. This command may ask you to enter your password. (Note: super-user means administrator in Unix).

Accessing your files

In your current directory, do run the command explorer.exe . to open your current directory using windows explorer!

JShell Related Issues

In the event that you are unable to edit sets of code in Jshell, you will need to setup its editor to vim. As a result, please do either one of the two steps:

  1. bash shell: add in the following line export JSHELLEDITOR=vim

  2. jshell: Within your jshell program, run this command: /set editor vim

Clone this wiki locally