DEV Community

Smit Gabani
Smit Gabani

Posted on • Updated on

Setting up WSL environment with VSCode, git, node.

Setting up an environment for cloud development is very important because you need to setup up environment and use environment variables while developing and deploying your application.

As we know Linux is the operating system used for the cloud because it is accepted everywhere and also because some cloud services are free if you use Linux operating system.

Today I will help windows user setup their Linux development environment with the help of Windows Subsystem for Linux (wsl).

Installing Windows Subsystem for Linux
You can take a look at the link below.

Run PowerShell as an administrator.

Run the command

// PowerShell
wsl --install
Enter fullscreen mode Exit fullscreen mode

Install distros for wsl from Microsoft Store
Some options are:

You need to restart your computer now.

Once you restart your computer you can confirm the installation by opening an Ubuntu bash terminal by searching Ubuntu in the Start menu.
You need to setup you ubuntu operating system (selecting an username and password and some setup like language etc.)
Use this command to confirm the setup.

// PowerShell 
wsl -l -v
Enter fullscreen mode Exit fullscreen mode

If you see Ubuntu you can move ahead with this article.

Now you need to setup your Linux operating system.

Run these set of command to setup your environment.
Upgrade you Linux System

// Linux - Ubuntu
sudo apt-get upgrade
Enter fullscreen mode Exit fullscreen mode

Check if git is installed

// Linux - Ubuntu
git --version
Enter fullscreen mode Exit fullscreen mode

Installing node and npm
If you are using ubuntu use this command to download Node.js v16.x

// Linux - Ubuntu
curl -fsSL | sudo -E bash -
sudo apt-get install -y nodejs
Enter fullscreen mode Exit fullscreen mode

You can check the link to download other versions for node for other distros.

To install jq which is a JSON parser for curl and the terminal use the command.

// Linux - Ubuntu
sudo apt-get install jq
Enter fullscreen mode Exit fullscreen mode

See that is very easy.

Setting up VSCode.

Install the Remote WSL extension from extensions tab.

Now you can open VS code in Linux Operating system and file system by clicking the green area in bottom left part of VS code.

Image description

Then choose new WSL window.
Once you open the new wsl window you can find where you are by using pwdon your terminal.

Exploring wsl file system using File Explorer.

To open the same file location using windows file explorer take a look at the image below.

Image description
To get here type the command given below on the address bar.

Enter fullscreen mode Exit fullscreen mode

Go to the below location to access your root dir

Enter fullscreen mode Exit fullscreen mode

You can create a directory here to work with.

On open VS code wsl window and Click on Open folder and select the folder you created

This is all for now I will edit this blog or add a new blog for instruction for setting up docker with wsl.

Top comments (0)