How to install Visual Studio Code on Debian 12

Endrit Qerreti

Endrit Qerreti

There are several ways to install Visual Studio Code on Debian 12.

However, in this tutorial you will learn how to install Visual Studio Code on Debian 12 by using the official repository.

The process of installing Visual Studio Code on Debian 12, is very simple.

First we need to add Microsoft GPG key, next we add the official repository of Visual Sutdio Code, and then we can finally install Visual Studio Code directly from the terminal, by running a single command.

Step 1 - Add Microsoft GPG Key

GPG key is necessary to be added on your system before being able to install Visual studio code. To add Microsoft's GPG key on your system, run the command below

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg

💡
Note: Make sure you have wget installed on your system.

Step 2 - Add Visual Studio Code Repository

Once you add Microsoft's GPG key on your system, proceed to add Visual studio code repository on your machine. This is the repository, from where Visual studio code package will be downloaded.

To add Visual studio code repository, run the command below

sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'

As you can see in the image above, Visual Studio Code repository is now added on our system.

Step 3 - Activate Visual Studio Repository

When you add a repository on your system, in order to use it, first you need to make it active. To make Visual studio Code repository active, simply update the repository database using the command below

sudo apt update

Step 3 - Install Visual Studio Code

Now you should be good to go ahead, and install Visual Studio Code on Debian 12.

sudo apt install code

Step 4 - Launch Visual Studio Code

There are also two ways to launch Visual Studio Code.

Launch Visual Studio Code using GUI

On the applications menu, search for "Visual studio code", and click to Visual studio icon to launch it

Launch Visual Studio Code using Terminal

To launch Visual Studio Code from the terminal, simply run

code

💡
Note: Both ways should work fine. However, the difference between GUI and terminal is that, when you launch it via terminal, Visual Studio Code process will remain active as long as the terminal window is active, which means if you close the terminal Visual Studio Code will also stop running. To avoid this from happening, you can launch Visual Studio Code from the applications menu normally.

Visual Studio Code GUI

Conclusion

In this tutorial, you learned how to install Visual Studio Code on Debian 12.