Visual Studio Code (VS Code) is a popular code editor renowned for its adaptability, extensive features, and ease of use for developers. It supports nearly all Linux distributions, including the latest Ubuntu 24.04. This guide explores several methods for installing it on Ubuntu 24.04.
Ways to Install Visual Studio Code on Ubuntu 24.04
- Through Deb File
- Through VS Code Repository
- Through the Snap Package installer
- Through App Center
Installing Through Deb File
For those seeking the most up-to-date version of VS Code, installing via the .deb
file is highly recommended. These files are typically available on the application’s official website.
Step 1: Obtain the .deb
file, either by visiting the Visual Studio Code official website and downloading it.
Step 2: Alternatively, use wget
with the download link:
wget https://vscode.download.prss.microsoft.com/dbazure/download/stable/019f4d1419fbc8219a181fab7892ebccf7ee29a2/code_1.87.0-1709078641_amd64.deb
Step 3: Navigate to the file’s location in the terminal.
Step 4: Install the .deb
package using apt
:
sudo apt install ./code_1.87.0-1709078641_amd64.deb
Step 5: Launch VS Code by typing code
in the terminal.
Installing Through VS Code Repository
If you prefer using apt
for package management, you can add the Microsoft VS Code repository.
Step 1: Install utility tools including software-properties-common
, apt-transport-https
, and wget
:
sudo apt install software-properties-common apt-transport-https wget
Skip this step if these utilities are already installed.
Step 2: Add the signing key for the VS Code repository by downloading the microsoft.asc
file:
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
Step 3: Verify the GPG key by listing all added keys:
sudo apt-key list
Step 4: Add the Visual Studio Code repository using the add-apt-repository
command:
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
Step 5: Update the system package list and install VS Code:
sudo apt install code -y
Step 6: Verify the installation by checking the VS Code version:
code --version
Step 7: Launch VS Code either from the command line by typing code
, or by searching for “Visual Studio Code” in the applications menu.
Installing Through the Snap Package Installer
The Snap package installer can be used if the application isn’t in Ubuntu’s default installer. Snap provides the classic version of VS Code.
Step 1: Execute the following command:
sudo snap install code --classic
Step 2: Confirm the installation by listing applications installed via Snap:
sudo snap list
Step 3: Launch Visual Studio Code with the command code
, or find it in the applications menu.
Installing Through App Center
Ubuntu’s App Center (GNOME Software) offers another way to install applications. This is suitable for users less familiar with the command line.
Step 1: Open the App Center.
Step 2: Search for “Visual Studio Code”
Step 3: Click Install
.
Step 4: After installation, click Open
or launch it from the applications menu.
Removing Visual Studio Code From Ubuntu 24.04
The removal process depends on the installation method used.
Step 1: If installed via Snap, use:
sudo snap remove code
Step 2: If installed via .deb
file or the Microsoft VS Code repository, use:
sudo apt remove --autoremove code
Step 3: To completely remove VS Code after using the repository, first remove the GPG key:
sudo apt-key del BC52 8686 B50D 79E3 39D3 721C EB3E 94AD BE12 29CF
(Replace the key with the one listed in your system).
Step 4: Remove repository files from the sources directory:
sudo rm archive_uri-https_packages_microsoft_com_repos_vscode-noble.list
sudo rm vscode.list
Step 5: Update the packages list:
sudo apt update
Step 6: If installed via App Center, find VS Code in the App Center and click Uninstall
.
Visual Studio Code offers many useful features, such as Git integration and a built-in terminal, making it a top choice for developers on Ubuntu 24.04.