Visual Studio Code (VS Code) is a lightweight yet powerful source code editor that supports debugging, embedded Git on Debian, syntax highlighting, intelligent code completion, and an extensive library of extensions. Whether you are building web applications with JavaScript and Node.js, writing Python scripts, developing PHP on Debian backends, or working with Docker containers on Debian and remote servers, VS Code provides integrated tools that streamline your workflow. By the end of this guide, you will have VS Code installed with automatic updates configured, ready for development work.
Looking for an open-source alternative? VSCodium on Debian provides the same editor without Microsoft telemetry.
Choose Your Installation Method
Multiple installation methods are available for VS Code on Debian. Each provides the same application but differs in how you configure and update it:
| Method | Channel | Version | Updates | Best For |
|---|---|---|---|---|
| Microsoft APT Repository | Official Repo | Latest stable | Automatic via apt upgrade | Most users who want direct updates from Microsoft |
| extrepo | Debian extrepo | Latest stable | Automatic via apt upgrade | Users preferring Debian-curated repository definitions |
| Flatpak | Flathub | Latest stable | Automatic via flatpak update | Users wanting sandboxed installation |
For most users, the Microsoft APT Repository method is recommended because it provides direct updates from Microsoft and integrates with your existing package management workflow. The extrepo method offers simpler repository setup with Debian-curated configurations, while Flatpak provides sandboxing at the cost of some system integration features.
Prepare Your Debian System
Update Package Lists
First, refresh your package index and upgrade existing packages. This step prevents dependency conflicts when you install VS Code:
sudo apt update && sudo apt upgrade
Install Required Packages
Next, install the packages you need to download the GPG key and configure the repository:
sudo apt install curl gnupg ca-certificates -y
Method 1: Install from Microsoft APT Repository (Recommended)
The official Microsoft repository provides the latest stable and Insiders builds with automatic updates through APT. This method gives you direct access to VS Code releases as Microsoft publishes them.
Import Microsoft GPG Key
First, download and convert the Microsoft GPG key to your systemโs keyring. This key verifies that packages originate from Microsoft:
curl -fSsL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/vscode.gpg >/dev/null
Add Microsoft VS Code Repository
Next, add the Visual Studio Code repository using the modern DEB822 format. This format provides cleaner syntax and better maintainability than legacy .list files:
The DEB822
.sourcesformat works on Debian 11, 12, and 13. Debian 12+ uses this format by default, while Debian 11 fully supports it even though legacy.listfiles remain common on older installations.
cat <<EOF | sudo tee /etc/apt/sources.list.d/vscode.sources
Types: deb
URIs: https://packages.microsoft.com/repos/vscode
Suites: stable
Components: main
Architectures: amd64 arm64
Signed-By: /usr/share/keyrings/vscode.gpg
EOF
After creating the sources file, update your package cache to include packages from the newly added repository:
sudo apt update
Next, verify that APT recognizes the VS Code repository:
apt-cache policy code
code:
Installed: (none)
Candidate: 1.x.x-xxxxxxxxxx
Version table:
1.x.x-xxxxxxxxxx 500
500 https://packages.microsoft.com/repos/vscode stable/main amd64 Packages
The output confirms the repository is active and VS Code is available for installation. Now proceed to the Install VS Code section below.
Method 2: Install Using extrepo
The extrepo tool manages third-party repositories using Debian-curated definitions. This method simplifies repository setup because extrepo handles GPG keys and source file creation automatically. The result is functionally identical to Method 1.
Install extrepo
First, install the extrepo package if you have not already:
sudo apt install extrepo -y
Enable Non-Free Policy
VS Code is in extrepoโs non-free policy category because it contains proprietary Microsoft code. By default, extrepo only enables main (free software). You must enable the non-free policy before adding the VS Code repository.
First, open the extrepo configuration file:
sudo nano /etc/extrepo/config.yaml
Then, find the enabled_policies section and uncomment - non-free so it looks like this:
enabled_policies: - main # - contrib - non-free
Save and close the file. Alternatively, use sed to make the change automatically:
sudo sed -i 's/# - non-free/- non-free/' /etc/extrepo/config.yaml
Enable the VS Code Repository
Once the non-free policy is enabled, add the VS Code repository:
sudo extrepo enable vscode
This command creates /etc/apt/sources.list.d/extrepo_vscode.sources and downloads the GPG key to /var/lib/extrepo/keys/vscode.asc.
Next, update your package cache:
sudo apt update
Finally, verify the repository is active:
apt-cache policy code
code:
Installed: (none)
Candidate: 1.x.x-xxxxxxxxxx
Version table:
1.x.x-xxxxxxxxxx 500
500 https://packages.microsoft.com/repos/vscode stable/main amd64 Packages
The output confirms extrepo successfully configured the Microsoft repository. Now proceed to the Install VS Code section below.
Method 3: Install Using Flatpak
Flatpak provides VS Code in a sandboxed environment with isolated dependencies. This method works well if you prefer application isolation or want to avoid adding external APT repositories.
Some VS Code features (integrated terminal, certain extensions) require additional Flatpak permissions. Review the Flathub documentation for details on permission management.
Install Flatpak and Flathub
If Flatpak is not installed on your system, set it up first. For complete instructions, see Flatpak on Debian. The quick setup commands are:
sudo apt install flatpak -y
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Install VS Code via Flatpak
Then, install the official VS Code Flatpak from Flathub:
sudo flatpak install flathub com.visualstudio.code -y
Afterward, verify the installation:
flatpak info com.visualstudio.code
Visual Studio Code - Code editing. Redefined.
ID: com.visualstudio.code
Ref: app/com.visualstudio.code/x86_64/stable
Arch: x86_64
Branch: stable
Origin: flathub
Version: 1.x.x
Finally, launch VS Code via Flatpak:
flatpak run com.visualstudio.code
As a result, the Flatpak installation creates a desktop entry, so you can also launch VS Code from your application menu after the first run.
Install Visual Studio Code
If you used Method 1 or Method 2 (APT repository methods), VS Code is available in two builds. You can install both simultaneously on the same system:
- Stable (recommended): Monthly updates with thoroughly tested features. Best for production development work.
- Insiders: Daily updates with the latest features and bug fixes. Choose this for early access to new functionality.
Install Stable Build (Recommended)
For most users, install the stable build for reliable daily development:
sudo apt install code -y
Install Insiders Build
Alternatively, install the Insiders build if you want early access to new features and are comfortable reporting issues:
sudo apt install code-insiders -y
You can install both builds on the same system. The stable version uses the
codecommand while Insiders usescode-insiders, so they operate independently without conflicts.
Verify Installation
After installation completes, confirm VS Code installed correctly by checking the package status:
apt-cache policy code
code:
Installed: 1.x.x-xxxxxxxxxx
Candidate: 1.x.x-xxxxxxxxxx
Version table:
*** 1.x.x-xxxxxxxxxx 500
500 https://packages.microsoft.com/repos/vscode stable/main amd64 Packages
100 /var/lib/dpkg/status
The Installed: line shows VS Code is now on your system. The 100 /var/lib/dpkg/status line confirms the package is locally installed. Additionally, verify the binary works by checking its version:
code --version
1.x.x commit-hash x64
This output confirms VS Code works correctly and APT will deliver automatic updates.
Launch Visual Studio Code
Launch from Terminal
To get started quickly, run the following command to open VS Code:
code
For the Insiders build:
code-insiders
Additionally, to open a specific project directory:
code /path/to/project
Launch from Applications Menu
Alternatively, access VS Code through your desktop environment:
- Click Activities in the top-left corner of your screen (GNOME) or open your application launcher.
- Search for โVisual Studio Codeโ or โCodeโ.
- Click the VS Code icon to launch the application.


Manage Visual Studio Code
Update Visual Studio Code
VS Code updates automatically through APT when you run system updates. To update VS Code along with all other packages:
sudo apt update && sudo apt upgrade
Alternatively, to update only VS Code without upgrading other packages:
sudo apt update && sudo apt install --only-upgrade code
For Flatpak installations, update using:
sudo flatpak update com.visualstudio.code
Remove Visual Studio Code
If you no longer need VS Code, the removal process depends on which installation method you used.
Remove APT Installation (Method 1)
First, remove the VS Code package:
sudo apt remove code
For the Insiders build:
sudo apt remove code-insiders
Next, remove the repository configuration and GPG key:
sudo rm /etc/apt/sources.list.d/vscode.sources
sudo rm /usr/share/keyrings/vscode.gpg
Refresh the package cache to remove the repository from APTโs database:
sudo apt update
Then remove any orphaned dependencies:
sudo apt autoremove
Remove extrepo Installation (Method 2)
First, remove the VS Code package:
sudo apt remove code
Then disable the extrepo repository:
sudo extrepo disable vscode
This adds Enabled: no to the sources file rather than deleting it. To completely remove the repository files:
sudo rm /etc/apt/sources.list.d/extrepo_vscode.sources
sudo rm /var/lib/extrepo/keys/vscode.asc
Refresh the package cache and remove orphaned dependencies:
sudo apt update
sudo apt autoremove
Remove Flatpak Installation (Method 3)
First, remove the VS Code Flatpak:
sudo flatpak uninstall com.visualstudio.code
Additionally, remove unused runtimes:
sudo flatpak uninstall --unused
Flatpak user data is stored in ~/.var/app/com.visualstudio.code/. Remove this directory if you want to delete all Flatpak VS Code settings and extensions.
Remove User Configuration Data
VS Code stores user settings, extensions, and cache in your home directory. These files persist after package removal.
Warning: The following commands permanently delete your VS Code settings, keybindings, snippets, installed extensions, workspace history, and cached data. Export any settings you want to keep before proceeding using the Settings Sync feature or by copying your configuration files.
To remove stable build user data, delete these directories:
rm -rf ~/.config/Code ~/.vscode ~/.cache/Code ~/.local/share/Code
Similarly, remove Insiders build user data with:
rm -rf ~/.config/Code\ -\ Insiders ~/.vscode-insiders ~/.cache/Code\ -\ Insiders ~/.local/share/Code\ -\ Insiders
If you installed via Flatpak, remove user data with:
rm -rf ~/.var/app/com.visualstudio.code
Verify Removal
Finally, verify that VS Code and its repository are no longer active:
apt-cache policy code
N: Unable to locate package code
This output confirms you removed both VS Code and its repository from your system.
Troubleshooting
GPG Key Errors
If you see signature verification errors during apt update, the system cannot find or read the GPG key:
Err:1 https://packages.microsoft.com/repos/vscode stable InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
This error occurs when APT cannot find the keyring file at /usr/share/keyrings/vscode.gpg, when the file has incorrect permissions, or when corruption occurred during download. To resolve this, re-download and reinstall the GPG key:
sudo rm -f /usr/share/keyrings/vscode.gpg
curl -fSsL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/vscode.gpg >/dev/null
sudo apt update
Afterward, verify the fix by confirming APT can now read the repository without errors:
apt-cache policy code
If successful, the output should show version information from the Microsoft repository rather than error messages.
Repository Not Found
If APT reports that the VS Code package cannot be located:
E: Unable to locate package code
This error means you have not configured the Microsoft repository or APT has not refreshed its package cache. Verify the sources file exists and contains the correct configuration:
cat /etc/apt/sources.list.d/vscode.sources
A correctly configured file should display:
Types: deb URIs: https://packages.microsoft.com/repos/vscode Suites: stable Components: main Architectures: amd64 arm64 Signed-By: /usr/share/keyrings/vscode.gpg
If the file is missing or incorrect, recreate it using the commands in the repository setup section, then run sudo apt update before attempting installation again.
extrepo Non-Free Policy Not Enabled
If extrepo enable vscode displays a message about license policies not being enabled:
None of the license inclusion policies in vscode were enabled. Please edit /etc/extrepo/config.yaml and enable the required policies
VS Code requires the non-free policy. Enable it by editing the configuration file:
sudo sed -i 's/# - non-free/- non-free/' /etc/extrepo/config.yaml
Afterward, retry the enable command:
sudo extrepo enable vscode
Conclusion
You now have Visual Studio Code installed on Debian with automatic updates configured. Whether you chose the Microsoft APT repository for direct updates, extrepo for Debian-curated repository management, or Flatpak for sandboxed installation, VS Code is ready for development work. The removal commands documented above provide a clean uninstall path for each method when needed. For remote development workflows, the Remote-SSH extension lets you edit files on remote servers directly. To use this feature, configure SSH on Debian first. To expand your development environment, explore the Nginx on Debian or MariaDB on Debian installation guides for web application backends.
Hi, this does not appear to work on Debian 12 aarch64 (Raspberry Pi), because only the amd64 version is available from the Microsoft repos.
As a work-around, can get the aarch64 .deb file from https://code.visualstudio.com/Download# and install using `sudo dpkg -i code_1.97.0-1738712383_arm64.deb` or similar.
Thanks for flagging this, mj1911. You were absolutely right. The previous version of this guide only specified
arch=amd64in the repository configuration, which excluded arm64 devices like the Raspberry Pi.The article has since been rewritten using the modern DEB822 repository format, and now includes both architectures:
Microsoft does provide arm64 packages in their VS Code repository, so Raspberry Pi users running Debian aarch64 can now install directly from the APT repository without needing the manual .deb workaround. Your feedback helped identify the gap. Thanks for documenting the workaround for others who encountered this before the update.