In this tutorial, you will learn to how install visual studio code on Debian 11. Microsoft’s Visual Studio Code (vscode) is a source-code editor developed for Windows, Linux, and macOS. The code editor supports debugging, syntax highlighting, automatic code completion, snippets, embedded Git control, etc.
Vscode is open source. It supports an abundance of extensions and acts as a version control system, thus facilitating project collaboration.
Prerequisites
- A system running Debian.
- An account with administrator privileges.
- A working network connection.
Installing Visual Studio Code on Debian
There are two ways to install VS Code on Debian:
- Installing with the repository.
- Installing deb files with apt
Installing with repository
The easiest and recommended way to install Visual Studio Code on Debian 11 systems is to enable the VS Code repository and install the VS Code package through the command line:
1. Start by updating the packages index and installing the dependencies by typing:
sudo nala update sudo nala install gnupg2 software-properties-common apt-transport-https curl
or
sudo apt update sudo apt install gnupg2 software-properties-common apt-transport-https curl
linuxips@debian: $ sudo apt install gnupg2 software-properties-common apt-transport-https curl Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: python3-distro-info python3-software-properties unattended-upgrades Suggested packages: bsd-mailx default-mta | mail-transport-agent needrestart powermgmt-base The following NEW packages will be installed: apt-transport-https curl gnupg2 python3-distro-info python3-software-properties software-properties-common unattended-upgrades 0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded. Need to get 1,094 kB of archives. After this operation, 2,018 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://security.debian.org/debian-security bullseye-security/main amd64 curl amd64 7.74.0-1.3+deb11u2 [270 kB] Get:2 http://deb.debian.org/debian bullseye/main amd64 apt-transport-https all 2.2.4 [160 kB] Get:3 http://deb.debian.org/debian bullseye/main amd64 gnupg2 all 2.2.27-2+deb11u2 [434 kB] Get:4 http://deb.debian.org/debian bullseye/main amd64 python3-distro-info all 1.0 [8,720 B] Get:5 http://deb.debian.org/debian bullseye/main amd64 python3-software-properties all 0.96.20.2-2.1 [49.7 kB] Get:6 http://deb.debian.org/debian bullseye/main amd64 software-properties-common all 0.96.20.2-2.1 [83.4 kB] Get:7 http://deb.debian.org/debian bullseye/main amd64 unattended-upgrades all 2.8 [88.6 kB] Fetched 1,094 kB in 0s (2,944 kB/s) Preconfiguring packages ... Selecting previously unselected package apt-transport-https. (Reading database ... 106205 files and directories currently installed.) Preparing to unpack .../0-apt-transport-https_2.2.4_all.deb ... Unpacking apt-transport-https (2.2.4) ... Selecting previously unselected package curl. Preparing to unpack .../1-curl_7.74.0-1.3+deb11u2_amd64.deb ... Unpacking curl (7.74.0-1.3+deb11u2) ... Selecting previously unselected package gnupg2. Preparing to unpack .../2-gnupg2_2.2.27-2+deb11u2_all.deb ... Unpacking gnupg2 (2.2.27-2+deb11u2) ... Selecting previously unselected package python3-distro-info. Preparing to unpack .../3-python3-distro-info_1.0_all.deb ... Unpacking python3-distro-info (1.0) ... Selecting previously unselected package python3-software-properties. Preparing to unpack .../4-python3-software-properties_0.96.20.2-2.1_all.deb . .. Unpacking python3-software-properties (0.96.20.2-2.1) ... Selecting previously unselected package software-properties-common. Preparing to unpack .../5-software-properties-common_0.96.20.2-2.1_all.deb .. . Unpacking software-properties-common (0.96.20.2-2.1) ... Selecting previously unselected package unattended-upgrades. Preparing to unpack .../6-unattended-upgrades_2.8_all.deb ... Unpacking unattended-upgrades (2.8) ... Setting up gnupg2 (2.2.27-2+deb11u2) ... Setting up apt-transport-https (2.2.4) ... Setting up python3-software-properties (0.96.20.2-2.1) ... Setting up curl (7.74.0-1.3+deb11u2) ... Setting up python3-distro-info (1.0) ... Setting up software-properties-common (0.96.20.2-2.1) ... Setting up unattended-upgrades (2.8) ... Creating config file /etc/apt/apt.conf.d/50unattended-upgrades with new versi on Created symlink /etc/systemd/system/multi-user.target.wants/unattended-upgrad es.service → /lib/systemd/system/unattended-upgrades.service. Synchronizing state of unattended-upgrades.service with SysV service script w ith /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable unattended-upgrades Processing triggers for man-db (2.9.4-2) ... Processing triggers for dbus (1.12.20-2) ... linuxips@debian: $
2. Import the Microsoft GPG key using the following curl command:
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
On success, the command will return OK.
3. Add the Visual Studio Code repository to your system:
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
4. Install the Visual Studio Code package with:
sudo apt update sudo apt install code
or
sudo nala update sudo nala install code
linuxips@debian: $ sudo nala install code ============================================================================= Installing ============================================================================= Package: Version: Size: code 1.70.2-1660629410 85.2 MB ============================================================================= Summary ============================================================================= Install 1 Packages Total download size 85.2 MB Disk space required 358.9 MB Do you want to continue? [Y/n] Y ╭─ Downloading… ────────────────────────────────────────────────────────────╮ │ Total Packages: 1/1 │ │ Last Completed: code_1.70.2-1660629410_amd64.deb │ │ Time Remaining: 0:00:00 ━━━━━━━━━━━━━━━━ 100.0% • 85.2/85.2 MB • 6.4 MB/s │ ╰───────────────────────────────────────────────────────────────────────────╯ ╭─ Installing Packages ─────────────────────────────────────────────────────╮ │Unpacking: code (1.70.2-1660629410) │ │Setting up: code (1.70.2-1660629410) │ │Processing: triggers for shared-mime-info (2.0-1) │ │Processing: triggers for mailcap (3.69) │ │Processing: triggers for desktop-file-utils (0.26-1) │ │╭─────────────────────────────────────────────────────────────────────────╮│ ││✔ Running dpkg … ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 0:00:00 • 3/3││ │╰─────────────────────────────────────────────────────────────────────────╯│ ╰───────────────────────────────────────────────────────────────────────────╯ Finished Successfully
That’s it. Visual Studio Code has been installed on your Debian desktop, and you can start using it.
Installing deb files with apt
apt is a command-line utility for installing, updating, removing, and otherwise managing deb packages on Ubuntu, Debian, and related Linux distributions.
To install local deb packages with apt you need to provide the full path to the deb file. If the file is located in your current working directory instead of typing the absolute path, you can prepend ./ before the package name. Otherwise, apt will try to retrieve and install the package from Ubuntu’s repositories.
$ sudo apt install ./code_1.70.1_amd64.deb
if you will be prompted to type Y to continue:
linuxips@debian: $ sudo apt install ./code_1.70.1_amd64.deb [sudo] password for techdhee: Reading package lists... Done Building dependency tree... Done Reading state information... Done Note, selecting 'code' instead of './code_1.70.1_amd64.deb' The following NEW packages will be installed: code 0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded. Need to get 0 B/85.2 MB of archives. After this operation, 359 MB of additional disk space will be used. Get:1 /home/techdhee/code_1.70.1_amd64.deb code amd64 1.70.1-1660113095 [85.2 MB] Selecting previously unselected package code. (Reading database ... 199013 files and directories currently installed.) Preparing to unpack .../techdhee/code_1.70.1_amd64.deb ... Unpacking code (1.70.1-1660113095) ... Setting up code (1.70.1-1660113095) ... Processing triggers for gnome-menus (3.36.0-1ubuntu3) ... Processing triggers for shared-mime-info (2.1-2) ... Processing triggers for mailcap (3.70+nmu1ubuntu1) ... Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
The apt
package manager will resolve and install all the package dependencies.
Installing deb files with dpkg
dpkg is a low-level package manager for Debian-based systems. Use the -i (or –install) option to install deb packages with dpkg.
$ sudo dpkg -i code_1.70.1_amd64.deb
linuxips@debian: $ sudo dpkg -i code_1.70.1_amd64.deb [sudo] password for techdhee: Selecting previously unselected package code. (Reading database ... 199013 files and directories currently installed.) Preparing to unpack code_1.70.1_amd64.deb ... Unpacking code (1.70.1-1660113095) ... Setting up code (1.70.1-1660113095) ... Processing triggers for mailcap (3.70+nmu1ubuntu1) ... Processing triggers for gnome-menus (3.36.0-1ubuntu3) ... Processing triggers for desktop-file-utils (0.26-1ubuntu3) ... Processing triggers for shared-mime-info (2.1-2) ...
That’s it. Visual Studio Code has been installed on your Debian desktop, and you can start using it.
Launching Visual Studio Code
VS Code can be launched from the command line by typing code or by clicking on the VS Code icon (“Applications -> Development -> Visual Studio Code”).
When you start VS Code for the first time, a window like the following will be displayed:
You can now begin installing extensions and configuring VS Code according to your preferences.
Conclusion
We’ve shown you how to install Vscode on Debian 11 systems. Your next step could be to install Additional Components and customize your User and Workspace Settings .
Related Linux Tutorials: