5 Ways to Install VSCode on Ubuntu 24.04

VS (Visual Studio) Code is an all-in-one tool for the text and the code editor. It has support for the most famous programming languages. Thus, a developer can use it for its development and as a normal editor. Moreover, Visual Studio Code is available across Windows, macOS, and Linux. 

Recently, Ubuntu has released its latest LTS 24.04. Our Today’s guide provides the possible installation methods of VS Code on Ubuntu 24.04.

Outline:

Install VS Code on Ubuntu 24.04

Visual Studio Code can be installed on Ubuntu 24.04 from the Snap Store, the Debian Package File, VS Code’s repository, and the Debian Package. Let’s learn how all these work:

Snap CLI

Snaps (the packages of the Snap Store) are installable for most of the Linux distributions. Visual Studio Code is also available as a Snap and can be installed as follows:

Step 1: Install and Enable Snap

First, install and enable the snap support on your Ubuntu 24.04:

  • Snapd: the daemon that manages the snaps.
  • Core: A snap utility that offers the dependencies for the available snaps.
sudo apt install snapd;sudo snap install core

Step 2: Install Visual Studio Code

VS Code is available on the snap store as “code” and can be installed as:

sudo snap install code --classic

Launch it using the “code” command or from the applications menu:

Let’s check the version installed:

See, the “1.89.1” is installed via the Snap method. Let’s go through the VS Code repository method:

VS Code Repository

Visual Studio Code’s repository also contains the latest VS Code. First, the GPG key is added to the trusted keys list for the repository’s authentication and then the repository is added. Here’s how I carried out its installation:

Step 1: Add the GPG Key

It’s time to add the GPG key for vs code’s repository:

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/microsoft.gpg

Step 2: Add the Repository

Add the Microsoft repository support for the VS Code stable:

sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"

Step 3: Install VS Code

Now, update the package list to load the packages from the newly added repository using the “apt update” command and then use the following command to install it: 

sudo apt install code

From the output, you can see that version “1.89.1” is being installed. 

Debian Package File

The .deb installable file of VS Code is available for Ubuntu (and other .deb-supported distros). Here’s how I installed the VS Code using its Debian Package File:

Step 1: Download the .deb File

Use the wget command with the downloadable link to download the debian package file, i.e., we are saving the file with the “code.deb” name:

Link of Download Page: VS Code Download Page

wget -O code.deb "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64"

Step 2: Install VS Code

Locate the downloaded file and use the “apt install or the dpkg -il” to install. You can use the absolute or the relative path to install (irrespective of the terminal’s location):

sudo apt install <path/to/deb/file>

If you observe, the version installed via this method (1.89.1) is the same as of the VS Code’s repository method.

Flatpak/Flathub

Flatpak package manager’s support is available on Ubuntu 24.04. The flatpak applications are stored on the flathub repository. Thus, your system must have flatpak installed and flathub support enabled to get any application.

Visual Studio code is available on the flatpak/flathub which can be installed, as follows:

Step 1: Install Flatpak/Add Flathub

First, install flatpak support on your Ubuntu:

sudo apt install flatpak

Next, add the flathub repository to install flatpak applications:

sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Step 2: Install VS Code

Install VS Code from the flathub/flatpak support using the command:

flatpak install flathub com.visualstudio.code
Let’s see which version is installed via the flatpak:

Let’s see which version is installed via the flatpak:

And it is “1.89.1” which is the same as done by all the above methods.

Snap GUI

Snap support is available through GUI as well, i.e., the App Centre of Ubuntu 24.04. Installing a package from the Snap GUI or the CLI, both have the same impact. Here’s how I searched and installed VS Code:

Open the Ubuntu App Centre and search  for the “Code”:

Click on it and then on the install button, i.e., password authentication is required to proceed further:

Soon, the VS Code will be installed, as can be seen below:

Update VS Code on Ubuntu 24.04

If you want to update the VS Code, you need to first identify from which source you carried out the installation. We have provided the commands for each method to update VS Code.

If Installed Using Snap

sudo snap refresh code

If Installed Using the Repository

First, update the packages index, if there is any updated VS Code available in the repository, it will be loaded

sudo apt update

And then you can use the install/upgrade command to get the updated VS Code:

sudo apt install code
sudo apt upgrade-only code

If Installed Using the Flatpak

flatpak update com.visualstudio.code

Remove VS Code From Ubuntu 24.04

Want to remove VS Code? Do you know which method you followed for installation? Do not be worried, I have explained all the removal methods.

Snap

Whether you have installed the VS Code from the Snap CLI or the Snap GUI, both will be removed using the command:

sudo snap remove code

VS Code Repository | Debian Package

sudo apt autoremove code --purge

Flatpak/Flathub

flatpak uninstall com.visualstudio.code

That’s how you can deal with the VS Code on Ubuntu 24.04.

Bottom Line

To install Visual Studio code on Ubuntu 24.04, you can use the snap command “sudo snap install code –classic” or the flatpak method. Moreover, you can also add the VS Code’s repository and download the Debian package’s file to get the VS Code on Ubuntu 24.04. 

However, all the methods provide the same version. You can follow any method to get the latest VS Code.