Setting up WSL environment with VSCode, git, node.
Published: 2022-09-13 22:06:58

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.
[https://docs.microsoft.com/en-us/windows/wsl/install](https://docs.microsoft.com/en-us/windows/wsl/install)

Run PowerShell as an administrator.

Run the command 

```
// PowerShell
wsl --install
```

Install distros for wsl from Microsoft Store
Some options are:
Ubuntu

**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
```
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
```


Check if git is installed 
```
// Linux - Ubuntu
git --version
```

**Installing node and npm**
If you are using ubuntu use this command to download Node.js v16.x
```
// Linux - Ubuntu
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
```

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

[https://github.com/nodesource/distributions/blob/master/README.md](https://github.com/nodesource/distributions/blob/master/README.md)

To install jq which is a JSON parser for curl and the terminal use the command.
```
// Linux - Ubuntu
sudo apt-get install jq
```

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2iwhjg31hgkkfuxk4t8n.png)

Then choose new WSL window.
Once you open the new wsl window you can find where you are by using `pwd `on 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zl9qzwni7zuv629e8x0x.png)
To get here type the command given below on the address bar. 
```
\\wsl$
```

Go to the below location to access your root dir
```
\\wsl$\Ubuntu\home\yourusername
```

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.