Last updated:
VS Code is a lightweight, cross-platform code editor that supports hundreds of programming languages through extensions. It features syntax highlighting, auto-indentation, IntelliSense, and an integrated terminal, making it one of the most popular editors for development on Ubuntu 26.04 LTS and 24.04 LTS. Pair it with a language runtime such as Java on Ubuntu 24.04 to start building straight away.
Quick answer
The same steps work on Ubuntu 26.04 LTS and 24.04 LTS. The fastest install is sudo snap install --classic code. If you prefer normal apt upgrade updates, add Microsoft’s APT repository (Method 2) and run sudo apt install code. Plain sudo apt install code does not work until that repository is added, because VS Code is not in Ubuntu’s own archive.
What was verified: the commands and repository file below follow Microsoft’s Linux setup page, read on 28 October 2026. Microsoft’s package host could not be reached from our test machine, so the APT and deb steps were not re-run on 26.04, and the screenshots were captured earlier on Ubuntu 24.04.
How to Install Visual Studio Code on Ubuntu 26.04 and 24.04
| Method | Command | Auto-updates | Notes |
|---|---|---|---|
| Snap | sudo snap install –classic code | Yes (snap refresh) | Simplest install |
| APT (Microsoft repo) | sudo apt install code (after adding the Microsoft repo) | Yes (apt upgrade) | Full APT integration |
| deb file | sudo apt install ./code_*.deb | Yes, if you accept the repository prompt | Offers to add Microsoft’s repo during install |
| App Center | GUI — search VS Code | Yes | Installs Snap version |
| Flatpak | flatpak install flathub com.visualstudio.code | Via flatpak update | Sandbox may limit SDK access |
Method 1: Installing VS Code on Ubuntu 24.04 Using the Snap Package Manager
Install VS Code with all dependencies via Snap:
sudo snap install --classic code

The --classic flag is required. Without it, VS Code runs under strict confinement and cannot reach compilers, interpreters, or project folders outside your home directory, which breaks most real development work.
Verify the installation:
code --version

Run VS Code installed via Snap:
snap run code
Update the Snap-based VS Code:
sudo snap refresh code

Remove the Snap-based VS Code:
sudo snap remove code
Method 2: Install VS Code on Ubuntu 24.04 Using the APT Package Manager
This method adds Microsoft’s official repository so VS Code receives updates through standard apt upgrade. The same repository pattern is used when you install kubectl on Ubuntu 24.04 from a vendor APT source.
Step 1: Update System Repositories
sudo apt update && sudo apt upgrade -y

Step 2: Add Microsoft’s signing key and repository
Install the key into /usr/share/keyrings:
sudo apt install wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft.gpg
Create /etc/apt/sources.list.d/vscode.sources (deb822 format) with this content, for example with sudo nano /etc/apt/sources.list.d/vscode.sources:
Types: deb
URIs: https://packages.microsoft.com/repos/code
Suites: stable
Components: main
Architectures: amd64,arm64,armhf
Signed-By: /usr/share/keyrings/microsoft.gpg
Refresh the package lists. If you set this repository up earlier with the older vscode.list file and a key in /etc/apt/keyrings, remove that file first to avoid duplicate-source warnings:
sudo rm -f /etc/apt/sources.list.d/vscode.list
sudo apt update
Step 3: Install Visual Studio Code
sudo apt install code

Upgrade and remove via APT:
sudo apt upgrade code
sudo apt remove code
Method 3: Install Visual Studio Code on Ubuntu 24.04 Using a deb File
Download the .deb file from the official VS Code website:

Navigate to the Downloads folder and install it:
cd ~/Downloads
ls
sudo apt install ./code_*.deb
apt install ./file.deb installs the dependencies for you. The screenshot below used dpkg -i, which also works but may need sudo apt -f install afterwards if a dependency is missing.
Stuck at this step? Ask us, it is free and include the exact error.

Note: the deb installer asks whether to add Microsoft’s repository and signing key. Accept it and VS Code updates through apt upgrade; decline it and you must download each new deb yourself. For scripted installs, Microsoft documents echo "code code/add-microsoft-repo boolean true" | sudo debconf-set-selections before installing the deb. Look in /etc/apt/sources.list.d/ for a vscode.sources or vscode.list file to see which you have.
Remove VS Code installed via deb:
sudo dpkg --remove code

Method 4: Install Visual Studio Code on Ubuntu 24.04 Using the App Center
VS Code is available in Ubuntu’s App Center. Open it, search for code, and click Install:

Note: VS Code installed via App Center can be updated and uninstalled from App Center directly.
Method 5: Install Visual Studio Code on Ubuntu 24.04 Using Flatpak
Flatpak distributes VS Code on most Linux distributions. Note that Flatpak’s sandboxing may require extra permissions for some developer workflows (terminal access, SDK paths).
Step 1: Install Flathub
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

sudo flatpak install flathub

Install VS Code from Flathub:
flatpak install flathub com.visualstudio.code

Update VS Code via Flatpak:
sudo flatpak update --app com.visualstudio.code

Run and remove VS Code via Flatpak:
flatpak run com.visualstudio.code
flatpak remove com.visualstudio.code
First steps after installing VS Code
The code command is the fastest way to work. Opening a folder as a workspace is what enables project-wide search, integrated Git, and per-project settings:
code .
code myfile.py
code --diff old.txt new.txt
Extensions can be installed from the command line as well, which is useful when setting up a new machine or scripting an environment. Install a language pack for whichever runtime you use:
code --install-extension ms-python.python
code --list-extensions
Open the integrated terminal with Ctrl+`. It inherits your normal shell, so compilers and interpreters already on your PATH work without extra configuration — including toolchains such as Go on Ubuntu 24.04.
Troubleshooting VS Code on Ubuntu 26.04 and 24.04
| Problem | Likely cause | Fix |
|---|---|---|
code command not found |
Installed via Flatpak | Use flatpak run com.visualstudio.code or add a shell alias |
| Extensions cannot reach compilers | Snap installed without --classic |
Reinstall with sudo snap install --classic code |
| Repeated keyring password prompt | No unlocked keyring for Settings Sync | Install gnome-keyring |
| Blurry text on HiDPI | Running through XWayland | Enable native Wayland support |
| Settings reset after reinstall | Different package format, different config path | Use one install method consistently |
Repeated keyring prompts
VS Code stores Settings Sync and extension credentials in the system keyring. On a minimal Ubuntu install the keyring may be absent, which produces a password prompt at every launch:
sudo apt install gnome-keyring
Blurry text on a HiDPI display
By default VS Code runs through XWayland, which scales the window rather than rendering natively. Launch it with Wayland enabled to test whether that sharpens the text:
code --enable-features=UseOzonePlatform --ozone-platform=wayland
Where VS Code keeps your settings
Each package format stores configuration in a different place, which explains why settings appear to vanish when you switch install methods. The deb and Snap builds use ~/.config/Code, while Flatpak uses ~/.var/app/com.visualstudio.code. Extensions live in ~/.vscode/extensions for the deb and Snap builds. Back up those directories before reinstalling.
Which VS Code install method should you choose?
Use Snap or App Center when you want a simple desktop install with automatic updates. Use Microsoft’s APT repository when you want standard apt upgrade behavior and tighter system integration.
Flatpak works if most of your desktop apps come from Flathub, but some developer workflows may need extra permissions to access SDKs, terminals, or project folders outside the sandbox. The same Flathub method also installs desktop apps such as VLC on Ubuntu 24.04.