213

I downloaded the .tar.gz version of VS Code for Ubuntu (64-bit) and have been able to run it smoothly for some time. Some extensions have been installed too.

How can I efficiently update this VS Code installation? One thing I can think of is to just download the new .tar.gz archive and extract to the same location, just keeping the old "extensions" folder.

If I use the .deb version, would the same process be needed? Would I download the new .deb every time there is an update?

Eliah Kagan
  • 119,640
ramcrys
  • 2,231
  • 2
  • 11
  • 5

13 Answers13

223

The following commands work for me:

wget 'https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64' -O /tmp/code_latest_amd64.deb
sudo dpkg -i /tmp/code_latest_amd64.deb

Place those two commands into an executable Bash script called auto-update-vscode, and you can simply run that from your shell any time Visual Studio Code says it's out of date.

Federico
  • 103
Joe Bergevin
  • 2,489
175

Updated answer October 2021:

If you installed the software using the .deb file you don't have to download the package manually. You can just do:

sudo apt update 
sudo apt install code

Thanks to @MuhammadSheraz


Old answer:

sudo apt-get update
sudo apt-get install code 

source: https://code.visualstudio.com/docs/setup/linux

56

Vladimir S. posted the correct solution, although he originally didn't link directly to the section that had the answer. The direct link is here.

For those who'd rather not click, here's the official solution per Microsoft:

Debian and Ubuntu based distributions

The easiest way to install for Debian/Ubuntu based distributions is to download and install the .deb package (64-bit) either through the graphical software center if it's available or through the command line with:

sudo dpkg -i <file>.deb
sudo apt-get install -f # Install dependencies

Installing the .deb package will automatically install the apt repository and signing key to enable auto-updating using the regular system update mechanism (apt update). Note that 32-bit and .tar.gz binaries are also available on the download page.

The repository and key can also be installed manually with the following script:

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] http://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

Then update the package cache and install the package using:

sudo apt-get update
sudo apt-get install code # or code-insiders
Pablo Bianchi
  • 17,371
15

In true Microsoft style, they decided to call the package just code. So download the latest .deb and:

sudo dpkg -r code
sudo dpkg -i code_downloaded_package.deb

Configuration files, installed extensions and even currently used folder are preserved.

Kevin Bowen
  • 20,055
  • 57
  • 82
  • 84
Marc
  • 466
5

If you get an error message

code is already the newest version (x.xx.x-xxxxx)

The simplest solution is to download the latest binary from the Official Source and then install it by executing the following:

sudo apt install /home/xyz/Downloads/code_x.xx.x-xxxxxxx.deb

This will reinstall code over the older version. Your settings and installed extensions will remain unchanged as expected.

Reference

Niket Pathak
  • 263
  • 3
  • 9
5

Since version 1.10.2, Visual Studio Code has got the official signed repositories for Linux. Please look here.

4

Snap

Visual Studio Code is officially distributed as a Snap package in the Snap Store:

You can install it by running:

sudo snap install --classic code # or code-insiders

Once installed, the Snap daemon will take care of automatically updating VS Code in the background. You will get an in-product update notification whenever a new update is available.

Source: https://code.visualstudio.com/docs/setup/linux

B0rk4
  • 1,673
4

Use the script available in this repository: github.com/moeenz/vscode-updater

Unknown
  • 49
3

According to the issue Setup apt repository to enable OS-level updating on Debian-based systems #2973, the official PPA is still in progress.

There are two PPAs hosted on GitHub and openSUSE. You can use https://github.com/tagplus5/vscode-ppa before Visual Studio Code has its official PPA.

2

The .deb version and the apt version are two different versions for vs code.

The apt version can update by itself while the .deb version cannot.

It seems that the apt version is better, but it might not be the newest version, and for users using languages other than English, some input methods like Sogoupinyin(Chinese) won't work in this version.

The only way I found to update the .deb version is to install it again.

1

Follow the steps given below:

  1. Download the latest version of Visual Studio Code as a .deb package.

  2. Install GDebi Package Installer (if not installed).

  3. Then remove Visual Studio Code (older version) by opening its .deb package (which you downloaded earlier) using GDebi Package Installer and then click on "Remove Package" option.

  4. Then open the .deb package of the latest version of Visual Studio Code using GDebi Package Installer and click "Install Package" and install latest version of Visual Studio Code.

All your configurations (packages installed and other customisations) in Visual Studio Code which you did earlier will be restored automatically even after following the above procedure. So you need not worry about installing the packages again. You will find those customisations and packages automatically in the latest version you have installed.

Updating through this procedure doesn't remove/purge configuration files of Visual Studio Code and that's why, all your configurations in Visual Studio Code are restored.

This procedure works also for other code editors, like Sublime Text 3 and Atom. I have myself tested and verified it.

0

Just double-click the downloaded .deb and you are good to go! My system is Ubuntu Mate 22.04 but it's the same.

PS: The only side effect is that I lost the icons of the program - replaced by a not-found image!

centurian
  • 131
-1

Get the .deb file from https://code.visualstudio.com and run it from system package manager. Here's the official source link.