How to Install Visual Studio Code on Debian 11

Visual studio code is an open-source code editor which is launched by Microsoft and is used for various programming languages including Python, C, and Java to debug and edit their codes. Other than this, syntax highlighting, intelligent code completion, and code refracting features are also supported by the Visual Studio code. It has an extensible library which provides ease to the developers in coding as they can support the dedicated software development.

It is launched for all the operating systems including the distributions of Linux. In this write-up, we will learn the installation procedure of Microsoft Visual Studio code on Debian 11.

How to install Visual Studio Code on Debian 11?

It is recommended to update the repository of Debian once a time you use it, so all the packages get up to date and if some packages need an upgrade, we can do so though. To update, execute the command:

$ sudo apt update

After the update, we will install the curl command:

$ sudo apt install curl -y

In our case it has already been installed, once it is installed, execute the other command to install the apt-transport-https:

$ sudo apt install apt-transport-https -y

Now, we cannot install the visual studio code package from the repository of Debian as it is not available there, so we will import the GPG key from the official website of the Microsoft by using the command:

$  curl -sSL https://packages.microsoft.com/keys/microsoft.asc -o microsoft.asc
gpg --no-default-keyring --keyring ./ms_signing_key_temp.gpg --import ./microsoft.asc
gpg --no-default-keyring --keyring ./ms_signing_key_temp.gpg --export > ./ms_signing_key.gpg
sudo mv ms_signing_key.gpg /etc/apt/trusted.gpg.d/

Once the GPG key has been imported, also import the repository of Microsoft Visual Source by using the command:

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

Once both the key and the source repository are imported to the repository of Debian 11, update the repository of Debian 11 once again.

$ sudo apt update

After updating the repository again, install the visual studio code by executing the command:

$ sudo apt install code -y

To confirm the installation of the Visual Studio Code, execute the following command to check the version of the installed visual studio code.

$ code --version

To launch the Visual Studio Code from the terminal, execute:

$ code

After the statement has been executed, the window of the Visual studio code will be launched.

Now if we want to uninstall the visual studio code from Debian 11, run the command in the terminal:

$ sudo apt purge code -y

Conclusion

Visual studio code is a code editor which is used to run and edit different codes of different programming languages which can be used for different purposes by developers. It can be run in any operating system either it is Windows or Linux, it can be run in them. This provides ease to the developers to use the same platform for debugging the different codes in various programming languages. This write-up elaborates the installation steps of Visual studio code in Debian 11, in which we imported the GPG key and source repository of the Visual Studio Code from the official website of Microsoft to the repository of Debian 11. Once they are imported, update the repository of  Debian 11 and install it. After the successful installation, we have displayed the version of the installed package, and in the last, we executed the command to remove the Visual Studio Code from Debian 11.