How to Install VS Code & Keep Updated via the Official Repository in Ubuntu

Want to install the latest Visual Studio Code IDE and keep it updated via Update Manager in Ubuntu, Debian, or Linux Mint?

Microsoft offers an official apt repository for Debian based systems contains the latest code packages. And here’s the step by step guide shows you how to add it in your system.

If you’re just looking for the VS Code package for Linux, go to its download page.

1. Enable https support for apt:

Firstly, you have to make sure https is supported by running command:

sudo apt install apt-transport-https

2. Add Microsoft repository key:

The key is required so Ubuntu will trust the packages from that repository.

Firstly run command in terminal to download the key (install curl if you don’t have it via ‘sudo apt install curl’ command):

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg

Then install it via command:

sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/

3. Add the official VS Code repository:

To add the repository, run command:

sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

4. Finally install or update the code IDE:

If you don’t have the Code installed, run command:

sudo apt install code

If you have already installed an old version, you should now be able to update the package via Software Updater (Update Manager):

(Optional) 5. Remove the VS Code Repository:

If you change your idea, simply remove the apt repository by going to Software & Updates -> Other Software:

Or run command in terminal which will work on Debian, Ubuntu, Linux Mint:

sudo rm /etc/apt/sources.list.d/vscode.list
Merilyn Ne
Hi, I'm Merilyn Ne, a geek who has been working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.