How to Install VSCode on Debian 12, 11 or 10

Visual Studio Code, often abbreviated as VSCode, has emerged as a top-tier code editor favored by developers worldwide. Its adaptability and comprehensive features make it a go-to tool in the coding realm. Using Microsoft’s official VSCode repository, Debian users can ensure they’re always equipped with the most recent software updates.

Distinguishing Features of Visual Studio Code for Debian Users:

  • Adaptable Environment: VSCode’s extensive library of extensions empowers Debian developers to customize their workspace, enhancing productivity and catering to individual project requirements.
  • Unified Workspace: The integrated terminal in VSCode offers the convenience of executing code, debugging, and managing version control, all from a singular interface, streamlining the development workflow on Debian systems.
  • Broad Language Compatibility: VSCode supports many programming languages, ensuring that Debian developers can seamlessly transition between different projects without needing multiple editors.
  • Efficient Version Control: The native Git integration in VSCode facilitates smooth version control operations, a boon for Debian developers keen on maintaining organized and up-to-date code repositories.

Armed with these features and more, Visual Studio Code offers a robust coding environment, making it an invaluable asset for developers operating on Debian platforms. Let’s proceed to learn how to install the IDE software.

Pre-installation Steps for VSCode

Update Debian Before Visual Studio Code Installation

Before diving into the installation process, ensuring your Debian system is updated with the latest packages is essential. This will help prevent any potential conflicts during the installation of Visual Studio Code.

To update your system, open a terminal and run the following command:

sudo apt update

After updating the package list, proceed to upgrade any outdated packages with the following command:

sudo apt upgrade

Install Required Packages for VSCode

Next, you’ll need to install a few required packages to ensure a smooth installation of Visual Studio Code. These packages are standard across most Linux distributions and help manage repositories and securely download files.

Run the following command to install the necessary packages:

sudo apt install dirmngr ca-certificates software-properties-common apt-transport-https curl -y

Following these pre-install steps, you’ve prepared your Debian system to install Visual Studio Code. In the following steps, you’ll learn how to add the official Microsoft repository and install the latest version of Visual Studio Code.

Import Visual Studio Code APT Repository

In this step, you’ll learn to import the official Microsoft repository for Visual Studio Code to ensure you get the latest version from a trusted source.

Import Microsoft GPG Key

First, you need to import the Microsoft GPG key, which allows your system to verify the authenticity of the Visual Studio Code installation package. To do this, run the following command in your terminal:

curl -fSsL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/vscode.gpg >/dev/null

This command downloads the GPG key from Microsoft’s server and adds it to your system’s keyring.

Add Microsoft VSCode APT Repository

Now that you’ve imported the GPG key, the next step is to add the Visual Studio Code repository to your system. This lets you install and update Visual Studio Code directly from Microsoft’s official repository.

Run the following command in your terminal to add the repository:

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

This command adds the repository to your system’s list of package sources, making it accessible when searching for packages to install or update.

With the repository imported, you’re now ready to install Visual Studio Code on your Debian system.

Finalize Installation of VSCode

Before starting the installation process, it’s essential to understand the distinction between Visual Studio Code and Visual Studio Code Insiders. Each offers unique benefits tailored to different user needs.

  • Visual Studio Code:
    • Stable release of the editor.
    • Undergoes rigorous testing for a dependable coding experience.
    • Ideal for developers valuing stability and reliability.
  • Visual Studio Code Insiders:
    • Beta or “preview” version.
    • Offers a glimpse into upcoming features.
    • It is constantly updated with innovations.
    • It might not be as exhaustively tested as the stable version; there is potential for bugs.
    • It is favored by adventurous developers or those wanting early access to features.

Both versions can coexist on a system with separate installations, letting developers toggle between stable and beta environments.

Update APT Cache Index After VSCode APT Repo Import

Before proceeding with the installation of Visual Studio Code, it’s a best practice to ensure your system’s package list is current, especially after adding a new repository:

sudo apt update

Select 1 or Both Versions of VSCode to Install:

Option 1: Install Visual Studio Code – stable build

For those who prioritize a stable and reliable coding environment, the following command will install the standard version of Visual Studio Code:

sudo apt install code

Option 2: Install Visual Studio Code – insiders build

If you want to explore the latest features, the Insiders version is for you and don’t mind the occasional bug. To install, use the command:

sudo apt install code-insiders

Note: It’s worth reiterating that Visual Studio Code’s standard and insider versions are designed to operate concurrently on your Debian system. This dual-installation feature ensures developers can effortlessly transition between a stable environment and a beta testing ground, depending on their project requirements.

Launch Visual Studio Code

CLI Commands to Launch VSCode

For those who enjoy using the terminal, you can launch Visual Studio Code quickly by entering the following command:

The stable version:

code

Those that want to install the insider (beta) version:

code-insiders

Graphical User Interface (GUI) Application Launch Method

If you prefer using the desktop environment to launch applications, you can find Visual Studio Code in your system’s application menu:

  1. Click on Activities in the top-left corner of your screen.
  2. Select Show Applications (usually represented by a grid icon).
  3. Locate Visual Studio Code or Visual Studio Code Insiders in the list of applications, or use the search bar to find it.

Additional Commands for VSCode

Remove Visual Studio Code

If you remove Visual Studio Code from your Debian system, follow the steps below to uninstall the software, remove the repository, and delete the GPG key.

To uninstall Visual Studio Code or Visual Studio Code Insiders, run the corresponding command in your terminal:

sudo apt remove code
sudo apt remove code-insiders

After uninstalling the software, remove the Microsoft Visual Studio Code repository from your system with the following command:

sudo rm /etc/apt/sources.list.d/vscode.list

Removing the GPG key associated with the Visual Studio Code repository is a good practice for enhanced security and proper system maintenance. To do this, run the following command:

sudo rm /usr/share/keyrings/vscode.gpg

Following these steps, you’ll have successfully removed Visual Studio Code, its repository, and the GPG key from your Debian system.

Conclusion

This guide teaches you how to install Visual Studio Code on Debian using the official Microsoft repository. Following the steps ensures you have the latest software version and can keep it up-to-date. Additionally, you’ve explored some tips and customizations to help you start with Visual Studio Code and learned how to remove the software if needed.

Useful Links

Here are some valuable links related to using Visual Studio Code:

Joshua James
Follow me
Latest posts by Joshua James (see all)