Visual Studio Code is a free source-code editor made by Microsoft for Windows, Linux macOS. Visual Studio Code features include support for debugging, embedded Git control, intelligent code completion, snippets, and code refactoring. Microsoft Visual Studio Code also has an extensive extension library that can further support dedicated software development and coding to enrich and help develop and use the software.
In the following guide, you will learn how to install Microsoft Visual Code Editor on Debian 11, Bullseye.
Table of Contents
- Recommended OS: Debian 11 Bullseye.
- User account: A user account with sudo privilages or root access (su command).
Updating Operating System
Update your Debian 11 operating system to make sure all existing packages are up to date:
sudo apt update && sudo apt upgrade
Root or Sudo Access
By default, when you create your account at startup with Debian compared to other distributions, it does not automatically receive sudoers status. You must either have access to the root password to use the su command or visit our tutorial on How to Add a User to Sudoers on Debian.
Install Dependencies for Installation
To install Microsoft Visual Studio, you will need to make sure the following packages are installed. Run the following command to verify or install the packages:
sudo apt install software-properties-common apt-transport-https curl -y
Install CURL Package
The tutorial will utilize the curl package to download the GPG key; Debian 11 has this installed by default but to verify:
Example output if installed:
curl 7.74.0 (x86_64-pc-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3 Release-Date: 2020-12-09
If you do not have curl installed, use the following command:
sudo apt install curl -y
Import GPG Key and Visual Studio Repository
First, you will need to import the Microsoft GPG key to verify the authenticity of the installation package:
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/
Example output if successful:
gpg: key EB3E94ADBE1229CF: public key "Microsoft (Release signing) <[email protected]>" imported gpg: Total number processed: 1 gpg: imported: 1
Secondly, import the Microsoft Visual Source Repository with the following command your terminal:
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
With the source repository sorted, you must refresh your apt package manager sources list to reflect the new addition before the Visual Studio installation. To do this, run the following command in your terminal:
sudo apt update
Now install Visual Studio with the following command:
sudo apt install code -y
To confirm the installation, you can use the verify version command as follows:
1.59.1 3866c3553be8b268c8a7f8c0482c0c0177aa8bfa x64
Launch Visual Studio Code
With the installation complete, you can run Visual Studio in a few different ways. First, while you are in your Debian terminal, you can use the following command:
Alternatively, run the code command in the background to free up the terminal:
However, this isn’t practical, and you would use the following path on your Debian desktop to open with the path: Activities > Show Applications > Visual Studio. If you cannot find it, use the search function in the Show Applications menu if you have many applications installed.
The first time you open Visual Studio, you will see the following window:
Congratulations, you have installed Microsoft Visual Studio Code on Debian 11 Bullseye.
Uninstall Visual Studio Code
To remove the Visual Studio software from your Debian system, run the following command in your terminal:
sudo apt autoremove code -y
Then for complete removal, delete the repository and GPG key:
sudo rm /etc/apt/sources.list.d/vscode.* sudo rm /etc/apt/trusted.gpg.d/ms_signing_key.gpg sudo apt update
Comments and Conclusion
The guide has shown you how to install Microsoft Visual Code for Debian 11 Bullseye and add the repository to update the program without manually re-downloading and installing. Microsoft Visual Code is one of the most used IDE editors on the planet. It is also lightweight and a great option for your system if you run services and servers instead of using the default Linux text editors such as vim or nano.