-
Notifications
You must be signed in to change notification settings - Fork 2
Setting Up Unix For Windows
Credits: Unix Workshop AY2020/21
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 in Semester 1, AY2020/21.
There are two versions, WSL 1 and, a newer, WSL 2.
For the Unix@Home workshop, it suffices for attendees to install WSL 1.
Before you proceed with the instructions below, you need to make sure that:
-
You have 64-bit versions of Windows 10, version 1607 or higher (Here is how you check);
-
You have administrator access to your Windows 10; And
-
You have an SoC Unix account. You can create an SoC Unix account here. For SoC students, this username is something that sticks with you for the rest of your SoC life -- so choose wisely.
Before you install WSL 1, you need to first enable the "Windows Subsystem for Linux" feature by running the following command in PowerShell.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
You can achieve this step by:
- Hit ⊞ Win to open the Start menu, type
PowerShell
, then right-click on Windows PowerShell, and click "Run as administrator" - Copy the command above by selecting it and then hitting Ctrl + C
- Go to your PowerShell window and paste the command above by hitting Ctrl + V . Press enter if needed to run the command.
After restarting your computer, go to the Microsoft Store and get Ubuntu 18.04 LTS.
The latest Ubuntu 20.04 LTS is reported reported to be unstable on WSL 1.
Follow the on-screen instructions to install.
When you are asked to create a user account and password, we suggest that you choose a Unix username that is that same as your SoC Unix username.
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.
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
asksapt
to obtain the latest list of available packages from the Internet. -
sudo
performsapt update
with a super-user's level permission. This command may ask you to enter your password. (Note: super-user means administrator in Unix).
In your current directory, do run the command explorer.exe .
to open your current directory using windows explorer!
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:
-
bash
shell: add in the following lineexport JSHELLEDITOR=vim
-
jshell
: Within your jshell program, run this command:/set editor vim