Install VS Code Editor on Ubuntu 22.04

In this article you are going to learn how to Install VS Code Editor on Ubuntu 22.04. Microsoft’s Visual Studio Code is a source-code editor available for Windows, Linux, and macOS. Support for debugging, syntax highlighting, intelligent code completion, snippets, code refactoring, and embedded Git are among its features. Users can customize the theme, keyboard shortcuts, and preferences, as well as install extensions that offer new features.

How to Install VS Code Editor on Ubuntu 22.04

We are going to Install VS Code using several methods;

Install VS Code Editor on Ubuntu 22.04 Via GUI

  • Open Ubuntu software center as shown below.
  • Search for vscode and click it to open.
  • Then click install button to continue with the installation.
  • When installation percentage reaches 100% VS code would have been installed. Open VS code editor by searching it on the application menu.
  • When you open VS code editor, you will required to configure it. Select settings that apply to you.
  • You can create new file by clicking New file or open existing file/project as shown below.
  • Example file

Uninstall VS code via GUI

  • To uninstall VS code editor, open Ubuntu software center and search for vscode as above. Click the remove button to uninstall.

Install VS Code Editor on Ubuntu 22.04 Via DEB Binary

  • Start by updating your system using the following command.
sudo apt update
  • Next run the command below to download the .deb package file.
wget -O vscode.deb 'https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64'
  • Then install the package using APT command below because it will solve any dependency issues unlike DPKG command.
sudo apt install ./vscode.deb

Uninstall VS Code Editor on Ubuntu 22.04

  • Run the following command to uninstall VS Code Editor.
sudo apt remove code -y 

Install VS Code Editor on Ubuntu 22.04 Via Repository

  • Start by adding VS Code editor repo.
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] \
https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
  • Next add the GPG key used by Microsoft to sign VScode packages.
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg

Then

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

Followed by

rm -f packages.microsoft.gpg
  • To notify the system that a new repository has been added, run sysytem update.
sudo apt update
  • After updating your system, install Vs code using the APT command below.
sudo apt install code

Sample output

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  galera-4 libaio1 libconfig-inifiles-perl
  libdbd-mariadb-perl libfprint-2-tod1
  libhtml-template-perl libllvm9 libmariadb3
  libpmem1 libreadline5 libterm-readkey-perl
  mariadb-client-10.7 mariadb-client-core-10.7
  mariadb-common mariadb-server-10.7
  mariadb-server-core-10.7 socat
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  code
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
Need to get 80.0 MB of archives.
After this operation, 339 MB of additional disk space will be used.
Get:1 https://packages.microsoft.com/repos/code stable/main amd64 code amd64 1.64.2-1644445741 [80.0 MB]
Fetched 80.0 MB in 4min 59s (267 kB/s)              
Selecting previously unselected package code.
(Reading database ... 202793 files and directories cu
rrently installed.)
Preparing to unpack .../code_1.64.2-1644445741_amd64.
deb ...
Unpacking code (1.64.2-1644445741) ...
Setting up code (1.64.2-1644445741) ...
Processing triggers for mime-support (3.64ubuntu1) ..
.
Processing triggers for gnome-menus (3.36.0-1ubuntu1)
 ...
Processing triggers for shared-mime-info (1.15-1) ...
Processing triggers for desktop-file-utils (0.24-1ubu
ntu3) ...

Install VS Code Editor on Ubuntu 22.04 Via Snapd

  • This method is similar to the GUI method though using terminal. Run the command below to install VS code editor via snap.
sudo snap install --classic code

Uninstall VS Code Editor on Ubuntu 22.04 via Snap

  • Run the following command to uninstall vs code editor via snap.
sudo snap remove code
  • You have reached the end of the article, Congratulations. You have learned how to install VS Code Editor on Ubuntu 22.04.

    Read more on VS Code Editor Documentation.

Other Tutorials

Install VeraCrypt on Ubuntu 22.04

Install MariaDB 10.7 on CentOS 7

Install PHP 7.4 on Ubuntu 18.04

System administrator | Software Developer | DevOps

Leave a Comment