
How to Install Visual Studio Code on Ubuntu 24.04 (3 Easy Methods)
Visual Studio Code, or VS Code, is a powerhouse in the world of code editors. Developed by Microsoft, it’s a free, open-source tool that has become a favorite among developers for its speed, extensive feature set, and a massive library of extensions. If you’re running the latest Ubuntu 24.04 LTS (Noble Numbat), getting VS Code set up is a straightforward process.
This guide will walk you through three distinct methods for installing Visual Studio Code on your system. Whether you prefer the simplicity of the Snap Store or the traditional control of an APT repository, you’ll be up and coding in minutes.
Prerequisites
Before you begin, ensure you have the following:
- A system running Ubuntu 24.04.
- Access to a user account with sudo or root privileges.
- A stable internet connection.
Method 1: Installing VS Code via the Snap Store (Easiest)
For users who want the quickest and most hands-off approach, installing VS Code as a Snap package is the ideal choice. Snap packages are self-contained applications that bundle all their dependencies, which simplifies installation and ensures they run consistently across different systems. They also update automatically in the background.
Since Snap is pre-installed on Ubuntu 24.04, you only need to run a single command. Open your terminal (Ctrl+Alt+T) and enter the following:
sudo snap install --classic code
This command downloads and installs the latest stable version of Visual Studio Code from the Snap Store. The --classic flag is necessary to grant the application the permissions it needs to access your system files, which is essential for a code editor.
Method 2: Installing VS Code using the APT Repository (Recommended)
This is the recommended method for most users who prefer traditional package management. By adding the official Microsoft repository to your system, you can install and update VS Code using the standard apt command, just like any other system package. This ensures seamless integration and reliable updates through Ubuntu’s Software Updater.
Step 1: Update Your System and Install Dependencies
First, it’s always a good practice to update your package index and install a few necessary tools that allow apt to use repositories over HTTPS.
sudo apt update
sudo apt install software-properties-common apt-transport-https wget -y
Step 2: Import the Microsoft GPG Key
Next, you need to import the Microsoft GPG key. This is a crucial security step that verifies the authenticity of the packages you are about to install, ensuring they haven’t been tampered with.
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
Step 3: Add the Visual Studio Code Repository
With the key in place, add the official VS Code software repository to your system’s source list.
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
Step 4: Install Visual Studio Code
Finally, update your package cache one more time to include the packages from the new repository, and then install VS Code.
sudo apt update
sudo apt install code
Your system will now manage VS Code updates alongside your regular system updates.
Method 3: Installing VS Code with the .deb Package
If you prefer to handle installations manually or need to install VS Code on an offline machine, you can download the .deb package directly from the official website.
The main drawback of this method is that it will not update automatically. You will need to manually download and install new versions as they are released to get the latest features and security patches.
Step 1: Download the .deb Package
Open your terminal and use wget to download the latest 64-bit .deb package for VS Code.
wget -O vscode.deb 'https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64'
Step 2: Install the Package
Once the download is complete, use the apt command to install the local file. Using apt is preferable to dpkg because it will automatically handle and install any required dependencies.
sudo apt install ./vscode.deb
After the installation finishes, you can safely delete the downloaded .deb file.
How to Launch Visual Studio Code
Regardless of the method you chose, you can now launch VS Code in two ways:
- From the Desktop: Click on the “Activities” button in the top-left corner, search for “Visual Studio Code,” and click the icon.
- From the Terminal: Simply type
codeand press Enter.
code
How to Uninstall VS Code
If you ever need to remove Visual Studio Code, the process is just as simple. Just be sure to use the command corresponding to your installation method.
If installed via Snap:
sudo snap remove codeIf installed via APT Repository or .deb file:
bash
sudo apt remove code
You now have a powerful and versatile code editor ready to go on your Ubuntu 24.04 system. Happy coding
Source: https://kifarunix.com/how-to-install-vs-code-on-ubuntu-24-04/


