Setting Up Your Development Environment - Start with WSL
Categories:
4 minute read
There’s a lot to install and setup. In total it may take close to an hour.
Overview
To try to establish a common development environment, we’d like students running Windows on their computer to install the Windows Subsystem for Linux (WSL). Almost certainly these days you’ll actually be using WSL2. Per Microsoft,
WSL 2 uses virtualization technology to run a Linux kernel inside of a lightweight utility virtual machine (VM). Linux distributions run as isolated containers inside of the WSL 2 managed VM.
tl;dr
Install
- Follow the steps at https://learn.microsoft.com/en-us/windows/wsl/setup/environment
- In doing these steps, you will have to create a user for your WSL instance. This user is separate from your windows user. You will need to remember the username and password you create here.
Files
- The files you work with in WSL will be in a filesystem that the rest of Windows will find at
\\wsl$\Ubuntu\home\<the username you created during the WSL install process>
. - Consider making a directory in that location called
dev
and doing all of your work for this course in subdirectories of that directory. This will make it easier to find your work later.- so the
dev
directory’s full path will be\\wsl$\Ubuntu\home\<your_user>\dev
- so the
Terminal
For your command line interface (CLI), it is probably best that you use Windows Terminal (click here to install it if you don’t have it already).
Windows Terminal can launch many different “shells”. Typically for our class work, you’ll want to use the Ubuntu shell. You can launch it from the drop down menu in the Windows Terminal tab bar.
Windows Terminal Window Behavior
- in many Terminal apps (Windows Terminal included), you can paste text into the terminal by right-clicking. Unlike the usual behavior in Windows, including in its own predecessors to the Windows Terminal, right-clicking does not open the context menu. It just pastes immediately.
- unlike many linux shells, highlighting text in Windows Terminal does not automatically copy it. You must use Ctrl+c to copy text.
- so then ctrl+c is overloaded in the Ubuntu shell running in Windows Terminal:
- if you have text selected, it copies the text
- if you have no text selected, it behaves like many other (e.g. Linux) shells and sends the ctrl+c signal to the shell, which is the signal to cancel the current process.
- so then ctrl+c is overloaded in the Ubuntu shell running in Windows Terminal:
VSCode
Install VSCode as directed on the Microsoft WSL VSCode page, except:
⚠️ Watch it! 👀
When I was doing this, it seemed that possibly 1 step of those instructions was out of order. After doing Install VS Code and the WSL extension and Update your Linux distribution, please:
- Ensure that you are in Windows Terminal in an Ubuntu tab before you try Open a WSL project in Visual Studio Code: From VS Code. If you get any error continue to the next step here ⬇️.
- Just skip the optional
Open a WSL project in Visual Studio Code: From VS Code
step, and proceed from Open a WSL project in Visual Studio Code: From VS Code.
When you open certain directories with VS Code, it may ask if you trust all authors of the code in the directory you’re opening. For the simple cases in our class, it’s probably best to say yes, so that … code in your project folder can be executed by VS Code and extensions without your explicit approval
.
Random Other Windows Trivia
Software
- Open Broadcaster Software (OBS) is great for streaming or screen recording.
- Clipboard history
- omfg, i can’t believe it’s finally built in now y’all. Back in my day we had to trust a third party for this, y’all don’t know how good you have it!
Hotkeys
So in the video I mentioned some hotkeys… here’s the ones I mentioned there or that I remembered later to add to this list after using them in class.
- Open Explorer (a file/folder browsing jobber)
- Win+E
- Put caret in address bar (keeping hands on the keys, focus the address bar of the currently focused app, e.g. the aforementioned Windows Explorer, Firefox, etc.)
- Ctrl+L
- Show the Desktop
- Win+D
- Open Task Manager
- Ctrl+Shift+Esc
- Switch between open windows
- Alt+Tab