How to Install Visual Studio Code on Debian 11 / Debian 10

0

Visual Studio Code (VSCode) is an open-source, cross-platform code editor developed by Microsoft that works with many different programming languages, including Python and JavaScript.

It also supports debugging, embedded Git Control, syntax highlighting, and code completion features.

Here, we will see how to install Visual Studio Code on Debian 11 / Debian 10.

Setup Visual Studio Code Repository

Microsoft provides VS Code package through its official repository. So, we must set up VS code repository on the system before we install VS Code.

Update the repository index using the apt command

sudo apt update

Install the HTTPS support for apt to get packages from Microsoft and other repositories.

sudo apt install -y curl apt-transport-https

Download and import the Microsoft signing GPG key.

Debian 11

curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/ms-vscode-keyring.gpg

Debian 10

curl -sSL https://packages.microsoft.com/keys/microsoft.asc -o microsoft.asc

sudo apt-key add microsoft.asc

Now, add the Microsoft Visual Studio Code repository to your system.

Debian 11

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/ms-vscode-keyring.gpg] https://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list

Debian 10

echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list

Install Visual Studio Code On Debian

Update the repository index.

sudo apt update

Use the below command to install the Visual Studio Code.

sudo apt install -y code

Launch Visual Studio Code

Once the VS Code is installed on your system, you can launch it from the command line with code or by going to Activities » Search for Visual Studio Code.

You will get the Get started with VS code window on the first launch.

Visual Studio Code Running on Debian
Visual Studio Code Running on Debian

Set VS Code as the default editor

If you have multiple source code editors on your system and want to set the Visual Studio Code as the default code editor, use the below command.

sudo update-alternatives --set editor /usr/bin/code

Update Visual Studio Code

Microsoft releases the update every month for VS Code. So, you can follow the below steps to update the Visual Studio Code to the latest version.

sudo apt update

sudo apt upgrade code

Conclusion

That’s All. You have successfully installed the Visual Studio Code on Debian 11 / Debian 10. Now, you are good to install extensions and customize VS Code according to your preferences.

You might also like