Visual Studio Code is not in the official Ubuntu repositories, but developers have created an external repo where the application is hosted. We will always have the latest version of the application and keep it updated from the update manager.
This installation process is very easy and will take a couple of steps.
First of all, let's open a terminal and execute the following commands:
sudo apt update
sudo apt install wget software-properties-common apt-transport-https
Then you have to download and import the GPG key from the Visual Studio Code repository:
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
This will allow the system to recognize that the repository is signed and that the packages are secure.
The next step is to add the repository to the system's list of software sources:
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
Let's update APT and install Visual Studio Code:
sudo apt update
sudo apt install code
If you didn't get any errors on the previous steps, you will be able to open the application from the main menu: