This is a step by step beginner’s guide shows how to install VS Code IDE and keep it up-to-date in Ubuntu 22.04, Ubuntu 23.04, Ubuntu 24.04 using 3 different ways.
Microsoft provides official code packages for Linux through native .deb
(for Debian/Ubuntu), .rpm
(for Fedora/SUSE), and universal Snap
package run in sandbox.
For choice, there’s also a community maintained Flatpak
package which also runs in sandbox.
So, there are 3 common ways to install this IDE in your Ubuntu Desktop!
Snap package is the easiest way to install VS Code (or code-insider) in Ubuntu. Which, also receives update automatically silently in the background. So, just install it, then you always have the latest version.
However, the Snap app runs in sandbox which might have permission or compatibility issues. And, so far it only support x86_64 (Intel/AMD
CPUs) CPU architecture types.
To install the package, simply search for & install it from Ubuntu Software (or App Center for 23.10/24.04):
Or, press Ctrl+Alt+T
on keyboard to open terminal, and run command to install the Snap package:
snap install code --classic
The Snap package can also be installed in most other Linux, see this page for details.
The open-source community seems to prefer Flatpak a bit more than Snap.
Code is available to install as Flatpak package in both x86_64 (Intel/AMD CPUS) and arm64 (Rasperry Pi, Apple Silicon, etc) machines.
Same to Snap, the only downside could be that it might have more issues compare to the native .deb
package.
Linux Mint (since 21) can search for install Code IDE as Flatpak directly from Software Manager. While, Ubuntu users need to run the commands below one by one to get it:
Finally, search for & launch the IDE from overview or start menu depends on your desktop environment (may need to log out and back in):
To install updates, use the command below in a terminal window:
flatpak update com.visualstudio.code
For more about the Flatpak package, go check the Flathub.org.
For those who do not like running app in sandbox, Microsoft also provides the classic .deb
package for Debian/Ubuntu, which so far supports x86_64 (amd64), arm64
, and armhf
CPU architecture types.
To download the package, simply go to its website via the link below:
Then, either double-click the .deb
package in file manager to open & install via “Software Install“. Or, press Ctrl+Alt+T
to open terminal, and run command to install the downloaded package:
sudo apt install ~/Downloads/code_*.deb
Download & install the .deb
package will automatically setup the repository for installing updates! However, it uses the old deprecated way that MAY not work in near future!
NOTE: For the time being, Microsoft may have corrected the issue in the .deb
package. So, do check before continuing. To do so, run command:
grep -q signed-by "/etc/apt/sources.list.d/vscode.list"; echo $?
This command will check if vscode.list
file contains “signed-by
” section that follows new Debian/Ubuntu policy! If it outputs 0, then yes, you don’t need to do this step anymore. If it output 1, then it’s still using the old deprecated source.
If the command above outputs 2, then the file does not exist! Try the command below to verify another sources file.
grep -q Signed-By "/etc/apt/sources.list.d/vscode.sources"; echo $?
And, if none of the last 2 commands above outputs “0”, then you have to manually setup the VS Code repository by following steps.
1 First, open terminal (Ctrl+Alt+T
) and run command to delete old in-correct source & key files if any.
sudo rm /etc/apt/sources.list.d/*vscode* /etc/apt/trusted.gpg.d/microsoft.gpg
2. Then, run command to download the key, dearmor it (so unreadable), and finally save to /etc/apt/keyrings
directory.
wget -q -O- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/keyrings/microsoft.gpg
3. Next, run command to create the source according to new Ubuntu policy:
sudo nano /etc/apt/sources.list.d/vscode.sources
This command will create the .sources
file and open it in nano command line editor. There, just paste following lines into it:
Types: deb URIs: https://packages.microsoft.com/repos/code Suites: stable Components: main Architectures: amd64 arm64 armhf Signed-By: /etc/apt/keyrings/microsoft.gpg
When done, press Ctrl+S (or Ctrl+O) to save file, and Ctrl+X to exit.
Finally, either run 2 commands below one by one to refresh package cache and install VS Code for the first time:
sudo apt update
sudo apt install code
For choice, replace code
with code-insider
or code-exploration
for installing different versions.
Or, launch Software Updater (Update Manager) to check if there’s any update for the package.
Depends on how you installed the IDE package, you may uninstall it through one of the ways below:
snap remove code code-insider
flatpak uninstall --delete-data com.visualstudio.code
Also run flatpak uninstall --unused
to clear up run-time libraries.
.deb
package, remove it by running command: sudo apt remove --autoremove code code-insider
Also, remove the source repository by deleting the corresponding files:
sudo rm /etc/apt/sources.list.d/*vscode* /etc/apt/keyrings/microsoft.gpg
Finally, run sudo apt update
to refresh system package cache.
The post How to Install Visual Studio Code in Ubuntu 22.04 & 24.04 [3 ways] appeared first on Osgrove.
One of the most critical gaps in traditional Large Language Models (LLMs) is that they…
Canonical is continuously hiring new talent. Being a remote- first company, Canonical’s new joiners receive…
What is patching automation? With increasing numbers of vulnerabilities, there is a growing risk of…
Wouldn’t it be wonderful to wake up one day with a desire to explore AI…
Ubuntu and Ubuntu Pro supports Microsoft’s Azure Cobalt 100 Virtual Machines (VMs), powered by their…
Welcome to the Ubuntu Weekly Newsletter, Issue 870 for the week of December 8 –…