Windows Subsystem for Linux (WSL) allows to run Linux binaries natively on Windows, and using Visual Studio Code, one can work on projects for Linux, let's see how to set this up:
-
Follow the course's instructions to enable WSL, i.e. until step 3.
-
Get the Ubuntu WSL (No Arch for today...) from here.
-
Open it and enter a username and password to set it up. (Beware! The password's characters are invisible)
- Follow the course's instructions at the GitHub section, if the key generation somehow results in
Saving key failed: Permission denied
, runsudo chown ${USER} ~/.ssh/
to fix the directory's ownership.
-
Get Docker Desktop here, the installation is straightforward, just make sure that anything mentioning WSL 2 is enabled, this will allow us to run Docker inside the WSL to run
make feedback
. -
Once the installation is done and you've logged out and in again, open Docker Desktop and go to the settings on the upper right once it's started, then Resources > WSL INTEGRATION and enable it for Ubuntu.
- Open Ubuntu then update and upgrade the system:
sudo apt update
sudo apt upgrade
- Then install the required packages for the lab:
sudo apt install make gcc git openssh-client manpages manpages-dev doxygen
sudo apt install libssl-dev libssl-doc libcurl4-openssl-dev libjson-c-dev
- Install Visual Studio Code if you haven't yet.
- Clone the lab's git repository.
- Go to its directory using the Ubuntu terminal and open it with VS Code by running the command
code .
(or runcode
following by the absolute path of the directory to open it from anywhere), this will setup everything and open a VS Code window, then eventually...
You can edit your project, and open an integrated WSL terminal (Upper Menu Bar > Terminal > New Terminal) to do anything Ubuntu-specific (apt
, gcc
, make
) while staying Windows!
Now that VS Code is setup, the next time you want to work using the WSL, no need to navigate to the directory from a Ubuntu terminal and run code .
.
Instead, open VS Code from Windows and click on the lower left icon, then choose "New WSL Window", this will attach a VS Code instance to the WSL like before, then navigate to the repo's directory using "Open Folder" (Use "Show Local" to show Windows folders).
You may also want to install the C/C++ VS Code extension if not already, to get more perks!