I've finally moved on from using a Hyper-V virtual machine as a development platform.

Although using a VM for development reduces the software clutter that accompanies it, I primarily use Visual Studio Code and troubleshooting errors is almost impossible with the Remote-SSH extension, because other extensions simply break in this scenario.

I needed an alternative, but I wanted to keep my development area isolated from the main OS, because things get messy. Although not as independent as a VM I've made the switch to using WSL2.

WSL2

A traditional VM experience can be slow to boot up, is isolated, consumes a lot of resources, and requires your time to manage it. WSL 2 does not have these attributes.

WSL 2 provides the benefits of WSL 1, including seamless integration between Windows and Linux, fast boot times, a small resource footprint, and requires no VM configuration or management. While WSL 2 does use a VM, it is managed and run behind the scenes, leaving you with the same user experience as WSL 1.

WSL 2 uses Virtual Machine Platform and Hyper-V to run a full Linux kernel with 100% system compatibility. The integration provided between the host and virtual machine provided by Microsoft with WSL2 greatly simplifies Linux based development.

WSL2 by default shares the host OS's PATH environmental variable, so Visual Studio Code in Windows can be opened using the command vscode . However this can cause issues if both host and virtual machine have applications using the same variables, e.g. if node is installed on both.

Installing WSL2

Since the Windows 10 build 2004, WSL2 can be installed with a single line in PowerShell.

wsl --install

Installing Ubuntu 20.04 LTS

Unfortunately, the easiest way to install Ubuntu 20.04 LTS for WSL2, is to use the Microsoft Store. The LTS release of Ubuntu is the best choice for development as many software developers only support the LTS releases due to their long term support, minimising the number of platforms they have to maintain and support themselves.

Use Cortana Search to search for Store.

Search the Windows Store for Ubuntu, and select Ubuntu 20.04 LTS or another appropriate LTS release.

Finally install Ubuntu 20.04 LTS.

Gatsby

Gatsby enables developers to build fast, secure, and powerful websites using a React-based framework and innovative data layer that makes integrating different content, APIs, and services into one web experience incredibly simple.

Check out my Gatsby Development Environment post for instructions on how to prepare for install Gatsby or as a starting point for developming any Node application.

Copyright Chad Tomlinson. All rights reserved.