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 24.04. Pair it with a language runtime such as Java on Ubuntu 24.04 to start building straight away.
Quick answer
The easiest way to install Visual Studio Code on Ubuntu 24.04 is Snap or App Center. If you want Microsoft’s official APT updates, install via the deb package or add the Microsoft repository so apt upgrade code keeps it current.
How to Install Visual Studio Code on Ubuntu 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 | Yes (apt upgrade) | Full APT integration |
| deb file | sudo dpkg -i code_*.deb | No (download new deb) | Manual version control |
| 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 Visual Studio Code GPG Key
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 /etc/apt/keyrings/packages.microsoft.gpg
Add the Microsoft repository:
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /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 dpkg -i code_1.87.0-1709078641_amd64.deb

Note: Packages installed via deb file do not update automatically. To get a newer version, download and install the latest deb from the website.
In practice the deb installer also adds Microsoft’s repository to /etc/apt/sources.list.d/vscode.list, so VS Code often starts updating through apt upgrade anyway. Check whether that file exists before assuming you are stuck on a fixed version.
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 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.