How to Install VS Code on Debian 12: A Step-by-Step Guide

Learn how to install Visual Studio Code on Debian 12 effortlessly with our comprehensive guide. Enhance your coding experience today!

Visual Studio Code (VS Code) is a powerful and versatile code editor developers worldwide love. Installing it on Linux is a straightforward process that can be accomplished in just a few simple steps.

If you’re using Debian 12 “Bookworm” as your operating system and want to harness the full potential of this powerful code editor, you’ve come to the right place!

This comprehensive guide will walk you through the step-by-step process of installing Visual Studio Code on Debian 12, empowering you to elevate your coding experience to new heights.

In addition, we will also show you how to install it as a Flatpak package, a widely adopted Linux community software distribution format.

Which of the two methods to choose? Well, it is entirely up to you. However, our recommendation is to stick with the native DEB format. So, let’s get started!

Install Visual Studio Code on Debian 12 “Bookworm”

This guide will use the sudo command and assuming you have sudo privileges.

1. Install Prerequisites

Before we begin the installation, we must install some packages that will be required to be available on our Debian 12 system for the next steps.

To accomplish this, type the following APT commands to update the package base and install prerequisites:

sudo apt update
sudo apt install software-properties-common apt-transport-https wget gpg

2. Import Microsoft’s GPG Key

To ensure that the packages we receive to install the Visual Studio Code are genuine, we should download and import the Microsoft signed GPG keys on our Debian 12 system.

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 /usr/share/keyrings/packages.microsoft.gpgCode language: JavaScript (javascript)
Import Microsoft’s GPG key.

Notice that none of the commands generate output.

3. Add Microsoft’s Visual Studio Code Repository

After importing Microsoft’s GPG keys, we’ll add the official Visual Studio Code repository to our Debian 12 system. This implies that the update package will be made available with the rest of your system’s regular updates if a new version is released.

To accomplish it, type the command shown below.

sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'Code language: JavaScript (javascript)
Add Microsoft’s VS Code repository.
Add Microsoft’s VS Code repository.

4. Run System Update

Before we proceed with VS Code installation on our Debian 12 system, we should update the list of available packages. So, run the below command to update Debian’s repositories index.

sudo apt update
Updating the repositories index.
Updating the repositories index.

5. Install VS Code on Ubuntu 22.04

Everything is already prepared for the actual installation. To install VS Code on our Debian 12 “Bookworm” system, run the following command and wait for the installation to complete.

sudo apt install code
Installing VS Code on Debian 12.
Installing VS Code on Debian 12.

6. Run Visual Studio Code on Debian 12

You can start using VS Code by launching it from the desktop application menu. Search for “code,” and when its icon appears, click to run the same.

Run Visual Studio Code on Debian 12.
Run Visual Studio Code on Debian 12.

When you start VS Code for the first time, a window like the following should appear:

VS Code runs on Debian 12.
VS Code runs on Debian 12.

When setting up your interface, you will be asked to choose a theme and have the ability to personalize your IDE to match your preferences.

For example, you can modify font size, color scheme, and layout settings. Furthermore, you can install extensions that expand the IDE’s capabilities and features.

Doing so will allow you to customize your development environment according to your requirements, making your coding experience more efficient and enjoyable.

Uninstall VS Code

If you uninstall Visual Studio Code from your Debian system for any reason, you can do it easily by running the provided command below:

sudo apt remove code

Install Visual Studio Code as Flatpak

Important notice: Remember that VS Code’s Flatpak version runs inside a container and cannot access SDKs on your host system!

Another way to install VS Code on Debian 12 is using Flatpak, a universal packaging format that simplifies software distribution across different distributions.

However, if you don’t have Flatpak support added to your system, don’t worry. We’ve got you covered, and you can learn how to do it quickly and easily with our comprehensive guide on the subject.

First, add Flatpak support to your Debian 12 system:

sudo apt install flatpak
Add Flatpak support to Debian 12.
Add Flatpak support to Debian 12.

Then, enable the Flathub repository:

sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepoCode language: JavaScript (javascript)

Finally, run the following to install Visual Studio Code on your Debian 12 system as Flatpak:

flatpak install flathub com.visualstudio.codeCode language: CSS (css)
Install Visual Studio Code on Debian 12 as a Flatpak app.
Install Visual Studio Code on Debian 12 as a Flatpak app.

Now, log out, log back in, and find and run VS Code from the list of the app launcher you are using.

Conclusion

In this guide, we have explored two different methods to install Visual Studio Code on Debian 12: as a native DEB package and using Flatpak. Each approach offers its own set of advantages, catering to users’ diverse needs and preferences.

For users seeking a straightforward and traditional installation process, the native DEB package method is the way to go. Leveraging Debian’s package manager, users can effortlessly install VS Code and benefit from system-wide integration, regular updates, and a seamless user experience.

On the other hand, the Flatpak approach appeals to those who prioritize application sandboxing and independent version management.

With your installation complete, you are ready to embark on a coding journey with Visual Studio Code, unleashing the true potential of your projects and streamlining your development workflow.

Thanks for your time! If you have any questions, please leave them in the comments section below. To learn more about Visual Studio Code, visit its official documentation page.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%

Leave a Reply

Your email address will not be published. Required fields are marked *