Microsoft Visual Code is a lightweight open source, extensible source code editor that comes with built-in Git support. Since Linux distributions including Debian are also open source. Using Visual code on Debian is beneficial as it provides command-line tools that can integrate with VS Code extensions. This blog explains several methods for installing Visual Studio Code on Debian 12.
5 Ways to Install VS Code on Debian 12
The major benefit of installing VS Code on Debian is that one can remotely access Linux using the VS Code WSL extension on the Windows operating system. There are primarily 5 ways to install Visual Studio Code on Debian.
1:Through Deb File
The most preferable method to install VS Code on Debian is using the deb setup file, which can be downloaded from the Visual Studio Code official site. Here you can select the deb file for different architectures, so simply click on the suitable one:
Next, a download pop-up will open and the file will begin to download:
Alternatively, the VS Code deb file can be downloaded on Debian using the wget utility and the download link as in the command below:
wget https://vscode.download.prss.microsoft.com/dbazure/download/stable/89de5a8d4d6205e5b11647eb6a74844ca23d2573/code_1.90.0-1717531825_amd64.deb
Now use the apt or dpkg package manager to install Visual Studio Code on Debian using its deb file:
sudo apt install ./code_1.90.0-1717531825_amd64.deb
Once the code editor is installed on Debian, simply execute the code command or search for it in the application’s menu:
code
2: Through Debian Software Install
Another way to install applications using their deb files is by using Debian’s software install application. Here, to install VS Code on Debian, simply click on the Open With option from the VS Code deb file right-click menu:
Next, select the Software Install app and click on Open:
Now click on the Install icon to proceed with VS Code installation on Debian:
Once the VS Code is installed, either click on the Open icon or search for VS Code in the application’s menu to launch it:
3: Through VS Code Repository
Since by default VS Code is not present in the Debian default package installer, to install it via the apt app installer you can add VS Code to the official repository. To add Visual Studio Code repository on Debian, first download its GPG key by executing the following command:
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
Next, install the downloaded VS Code GPG key on Debian 12 by executing:
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/keyrings/microsoft-archive-keyring.gpg
Next, add the VS Code repository on Debian by linking the GPG key added previously:
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
To apply the changes in the repository of the apt package manager, you need to update the packages list:
sudo apt update
Now use the apt package manager to install VS Code on Debian by using the below command:
sudo apt-get install code
Here in the image below, you can see that apt is using the VS Code repository for its installation on Debian 12:
Now execute the code command to launch Visual Studio Code:
code
On the other hand, you can launch it by searching Visual Studio Code in Debian’s app menu:
4: Through Flatpak App Installer
The fourth method to install Visual Studio Code on Debian 12 is using the Flathub repository and for that use:
flatpak install flathub com.visualstudio.code
To launch VS Code installed via Flatpak use the below command:
flatpak run com.visualstudio.code
Note: VS Code on Flatpak is unverified, so you might face any issues while compiling codes or while using various extensions.
5: Through the Snap Package Installer
The Last method for installing Visual Studio Code on Debian is using Snap, which is a third-party app installer for Linux distributions. This package manager has the classic version of VS Code. To install it via Snap run the below given command:
sudo snap install code --classic
To verify the installation of VS Code on Debian, you can list the applications installed via Snap:
sudo snap list
To launch the Visual Studio Code on installed via Snap reboot Debian and then execute the below command:
code
Conclusion
The Visual Studio Code on Debian can be installed in 5 different ways. These include using its deb file, Debian software install app, VS Code repository, Flatpak, and Snap package manager. The recommended way among all is to install it using Visual Studio Code deb file. There are two reasons for this. One is that it does not use any third-party software and can also be installed via system GUI. Second, it will be the latest version.