How to Install Visual Studio Code on Ubuntu 24.04?


Visual Studio (VS) Code is a powerful code editor developers use to write, debug, and manage code. It runs on multiple operating systems, i.e. Linux, Windows, and macOS. Installing it on Ubuntu 24.04 can enhance your development workflow. It also offers features like syntax highlighting, code completion, debugging, Git integration, and an integrated terminal.

Based on its importance, this guide will explain all possible methods to install Visual Studio Code on Ubuntu 24.04.

Let’s start the installation.

How to Install Visual Studio Code on Ubuntu 24.04?

VS Code is a versatile tool for various programming languages. For installing Visual Studio Code on Ubuntu 24.04, follow the stated methods:

Let’s begin with the first one.

Method 1: Install Visual Studio Code on Ubuntu 24.04 Using APT

VS Code is a well-known code editor that allows several features for programmers. To install Visual Studio Code (VS Code) from the official Ubuntu repositories, add the Microsoft repository, key, and install VS Code by following the below steps:

Step 1: Import the Microsoft GPG Key

First, run the “wget” command to import/add the GPG key to the system from the official website:

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

Note: Users can install required packages including wget, gpg utility, via the given command:

sudo apt install wget gpg

Step 2: Enable VS Code Repository

Now, create a Visual Studio Code repository file and enable it by typing the below script:

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'

Step 3: Update Packages List and Install Dependencies

First, users need to update the package cache and refresh the APT packages Index after importing the adding the repository:

sudo apt install apt-transport-https && sudo apt update

Step 4: Install Visual Studio Code

To install the VS Code on Ubuntu 24.04, use the “code” package with the “apt” command as below:

sudo apt install code

Step 5: Verify VS Code

Users can now authenticate that VS Code is installed by executing the “version” option:

code --version

Optional: Remove/Uninstall VS Code

To remove/uninstall the VS Code on Ubuntu 24.04, use the “autoremove” utility with the “apt” command as below:

sudo apt autoremove code # Remove VS Code (Package)

sudo apt purge code # Remove VS Code (Packages as well as Dependencies)

sudo apt autoremove code # Completely Remove VS Code

sudo rm -f packages.microsoft.gpg # Remove GPG Keys

That is all from the installation of Visual Studio Code on Ubuntu 24.04.

Method 2: Install Visual Studio Code on Ubuntu 24.04 Using the .deb Package

The easiest way is to download as well as install the .deb package (64-bit) for VS Code. For this, first, download the VS Code .deb package for Ubuntu 24.04. Then, install VS Code using the downloaded package. Let’s follow the below step-by-step instructions:

Step 1: Download the .deb Package

Visit the VSCode page and download the 64-bit .deb package. Or download the .deb package file for VS Code via the wget command:

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

Or download from GUI via the below figure:

Step 2: Install the .deb Package

Once the file is downloaded, move to the folder where users contain the downloaded .deb package and install it:

sudo apt install ./vscode.deb

If users are on a previous/older Ubuntu release, use the “dpkg” command:

sudo dpkg -i <file>.deb

It installs the apt repository automatically as well as the signing key for auto-updating with the help of the package manager.

Step 3: Verify VS Code Installation

Users can now authenticate that VS Code is installed by executing the “version” option:

code --version

Launch VS Code

After installation, users can launch VS Code from the application launcher by searching for “VSCode” and clicking on it. Or “code” command in the terminal:

code

That is all from the .deb package installation on Ubuntu 24.04.

Method 3: Install Visual Studio Code on Ubuntu 24.04 Using Snap

The Snap daemon updates VS Code automatically in the background. To install Visual Studio Code on Ubuntu 24.04 using Snap, follow the below steps:

Step 1: Install Snap

First, users need to install the snap before installing any new package:

sudo apt install snapd

Step 2: Install VS Code

To install VS code using snap on Ubuntu 24.04, execute the below command with the “sudo” privileges:

sudo snap install --classic code

Step 3: Verify VS Code Installation

Users can confirm the installation using the “snap list” utility. It enlists the installed packages using Snap:

snap list

Optional: Remove/Uninstall VS Code

Users can remove the VS Code from Ubuntu 24.04 via snap by the below command:

sudo snap remove --purge code

That is all from VS Code installation.

Method 4: Install Visual Studio Code on Ubuntu 24.04 Using the Ubuntu Software Center (GUI)

Users can install VS Code on Ubuntu 24.04 using GUI. It is one of the easiest methods for installing VS Code on Ubuntu. Let’s follow the installation steps:

Step 1: Open Ubuntu Software Center (App Store)

First, open the App Store to download the code package for Ubuntu:

Step 2: Search and Install code (Visual Studio Code)

Now, search the application name and click the “Install” button to download and install it:

Step 3: Launch VS Code

Finally, users can launch the VS Code by clicking the “Open” button and confirming its interface:

Remove/Uninstall VS Code

To remove/uninstall the “code” from Ubuntu, open the Ubuntu Software Center, search its name, and hit the “Uninstall” button. It is completely removed from the system:

That is all from the installation.

How to Use Visual Studio Code on Ubuntu?

VS Code works well on Ubuntu. After installation, open VS Code by using “code” in the terminal:

This opens VS Code to perform any programming task.

Conclusion

To install Visual Studio Code (VS Code) on Ubuntu 24.04, use the .deb package, APT repository, snap, and Ubuntu Software Center. The recommended way to install VS Code on Ubuntu is by downloading as well as installing the .deb package (64-bit). It sets up the apt repository automatically. Alternatively, users can install VS Code using snap via the “sudo snap install –classic code” command. Using GUI, users can also install VS Code through the Software Center.

Print Friendly, PDF & Email
Categories