Monday, July 31, 2023

How to install VS code in WSL \ Linux


### Option:1 [install using apt install ]

1. If wget is not installed, please install it using the command
2. if apt-transport-https is not installed then install it using the command 
 
```sh 
 sudo apt-get install wget
 sudo apt install apt-transport-https
``` 
3. Install code package 

```sh
sudo apt update
sudo apt install code # or code-insiders
```

Note: To avoid prompting when open VS code , set DONT_PROMPT_WSL_INSTALL environment variable as 1

```sh
export DONT_PROMPT_WSL_INSTALL=1

#add below variable in   ~/.bashrc to avoid adding environment in each instance of wsl distribution

alias code='DONT_PROMPT_WSL_INSTALL=1 code'

```



### Option:2 [Install using VS code debian package]

1. downdload debian package for [VS code installer for linux](https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64)

2. Move package to WSL home location

```sh 
mv /mnt/c/Users//<HostOS-UserId>/Downloads/code_1.80.2-1690491597_amd64.deb /home/<WSL-UserId>

```

3. Install VS code debian package [code_1.80.2-1690491597_amd64.deb]
```sh
sudo apt install ./code_1.80.2-1690491597_amd64.deb
```

No comments:

Post a Comment