How to install Visual studio code on Ubuntu

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to install Visual studio code on Ubuntu.

Visual studio code can be easily installed on Ubuntu, all you have to do is add visual studio code repository on your Ubuntu machine, and install Visual studio code directly from your terminal.

In this tutorial, we'll be installing Visual studio code on Ubuntu, by manually adding visual studio code repository so that we can install it from the terminal, without having to download the DEB file.

Step 1 - Update System

To make sure that your machine has no outdated packages, run the command below to check if there are packages that your machine needs updated.

sudo apt update

Step 2 - Import GPG Key

Before you add Visual studio code repository, first you must import Microsoft GPG key to make sure that you can install Visual studio code

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

Step 3 - Add Visual studio code repository

Now that you have added the GPG key, proceed to add visual studio code repository on your Ubuntu machine.

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 4 - Install Visual studio code

Now that you have added Visual studio code repository on your system, and verified the GPG key, you can now proceed to install Visual studio code on your machine.

To install Visual studio code, simply run the command below

sudo apt install code

Conclusion

By now you should know how to use Visual studio code repository to install Visual studio code on Ubuntu.