WSL Setup Instructions
by Justin Hu, Bwohan WangWorking with WSL (unsupported, Windows-only)
1) Installing WSL2
Windows Subsystem for Linux, or WSL, is a compatibility layer that allows Linux to run natively within Windows. To install WSL, follow the instructions below.
- Open Command Prompt, PowerShell, or Terminal as administrator.
- Within the prompt, type
wsl --install
.
After the command finishes, you should have a working WSL2 install on your computer.
2) Installing VS Code
If you have not already installed VS Code, you are encouraged to download the software at the following link: VS Code
Once it is installed, install the Remote - WSL
extension by either searching in the Extensions tab or using the following link: Remote - WSL
You can access the Extensions tab by clicking on the ‘Extensions’ icon in the navigation bar. While you are free to add other extensions based on your own preferences, make sure you have Remote - WSL
installed before continuing.
3) Installing the CS225 Container
Similar to the Dockerfile used for Docker, we provide a WSL2 image that contains a similar environment to the one we use for grading. To install the environment, follow the instructions below.
- Download the CS225 Container WSL image.
- Create a folder to store your WSL filesystem.
- This can be in any folder of your choice, such as
C:\Users\your-username\wsl\cs225\
orC:\wsl\cs225\
. - Warning: Do not delete this folder unless you intend on unregistering (uninstalling) the CS225 container. It contains the files required to run the container, as well as your course work.
- This can be in any folder of your choice, such as
- Open Command Prompt, PowerShell, or Terminal.
- Within the prompt, type
wsl --import cs225-container path-to-your-wsl-folder/ path-to-wsl-image.tar
.
After the command finishes, you should have the CS225 Container on your computer.
4) Using your environment
Using the Remote - WSL
extension on VSCode, run the command Remote-WSL: New WSL Window using Distro...
. You can do this by either clicking on the bottom left-hand corner widget (the green X-shaped button) or by pressing F1 and typing in the command.
Select the cs225-container
distro in the popup.
Your Windows directories will be mounted in /mnt/<drive-letter>/
. For example, C:\Users\user\Desktop\cs225\
will become /mnt/c/Users/user/Desktop/cs225/
.
You can choose to set up your course work directory either in a mounted directory (e.g., /mnt/c/Users/user/Desktop/cs225/
), or natively within WSL (e.g., /home/user/cs225/
). The latter will only be accessible within the WSL environment.
To close the environment, you can run wsl --shutdown
within Command Prompt, PowerShell, or Terminal. You can then always reopen it by running the Remote-WSL: New WSL Window using Distro...
command again.