How to install Visual Studio Code on Linux

Install Visual Studio Code using snap Package

How to install Visual Studio Code on Linux

VS Code is a powerful IDE, an open-source and cross-platform source code editor. It is developed by Microsoft that enables different developers to build applications and generate code using several programming languages in which python, C/C++, Java and Go are a few of them. It offers various amazing features in which built-in debugging support, syntax highlighting, integrated terminal, code completion; embedded Git control, snippets, and code refactoring are included. Visual Studio Code can install on different Linux flavors, macOS, and Windows operating systems.

This guide will explain the step-by-step installation of Visual Studio Code on Linux distributions.

Prerequisites

Linux distributions such as Debian, Ubuntu or CentOS should install on your system.

User should have root or sudo privileges

Install Visual Studio Code on Ubuntu, Debian, and LinuxMint Distributions

The most recommended and suitable method for installing the visual studio code IDE on Debian-based distributions is by including the VS code repository on your system and then installing the visual studio code package by using the apt command. Therefore, first, install the necessary system updates by using the below-mentioned command:

$ sudo apt update

Step 1:
Install VS Code Dependencies

After installing the all system updated, install required packages or dependencies by using the below-mentioned command:

$ sudo apt install software-properties-common apt-transport-https

screenshot of terminal

Step 2:
Import Microsoft GPG key

In this step, you will import the Microsoft GPG key for VS code by using the following wget utility as follows:

$ wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add –

screenshot of terminal

Step 3:
Enable Visual Code repository

Enable the VS code repository by executing the following command:

$ sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"

screenshot of terminal

Step 4:
Visual Studio Code installation

After enabling the VS Code repository, start the Visual Studio code installed on your system. Update the apt packages list and then install the VS Code editor by running the below-mentioned command:

$ sudo apt update

$ sudo apt install code

screenshot of terminal

Once the VS code installation is completed, you can start and use it on your Linux system.

Step 5:
Launch Visual Studio Code IDE

To launch the VS Code IDE on your Ubuntu system, search vs code in the application search bar. The following visual studio code icon shows in the search result.

screenshot of application search bar

When you start visual studio code first time on your Linux system, the following interface displays on the desktop:

screenshot of Visual Studio Code

Install Visual Studio Code on CentOS, Fedora distributions

The installation of VS code on Red hat based distributions is quite similar to Ubuntu. So, by using the dnf package manager, you can easily install visual studio code on CentOS, Fedora, and RHEL distributions. Login as a root user or with sudo privileges Update the system packages list by using the following command:

$ sudo dnf update

Now, import the VS code GPG key by using the rpm command as follows:

$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

Create a new VS code repository file by executing the below-mentioned command:

$ sudo nano /etc/yum.repos.d/vscode.repo

Paste the following lines in the repository file:

[code]

name=Visual Studio Code

baseurl=https://packages.microsoft.com/yumrepos/vscode

enabled=1

gpgcheck=1

gpgkey=https://packages.microsoft.com/keys/microsoft.asc

screenshot of dnf package manager

Finally, after adding the GPG key details use the following command to install visual studio code:

$ sudo dnf install code

screenshot of dnf package manager

Once the VS code installation is completed, launch it by using the application menu or by using the application search bar:

screenshot of application search bar

Install Visual Studio Code using snap Package

The VS code snap package distributed and managed by Microsoft teams. Almost all Linux distributions support the snap packages. Therefore, install the snap application and then type the following command to install VS Code editor on the Linux system:

$ sudo snap install --classic code

Conclusion           

We demonstrated different methods in this article about how to install VS Code on a Linux system. You can adopt any method from the all above-mentioned ways according to their installed Linux distribution. Using the VS code editor, you can develop applications using diverse programming languages but mainly used for C and Python programmers.

How To Set up a VSFTPD Server on a CentOS 7 VPS or Dedicated Server

Brief Description FTP is usually insecure exposing clear-text passwords, userna
2 min read
Avi Ilinsky
Avi Ilinsky
Hosting Expert

How To Set up a VSFTPD Server on an Ubuntu 16.04 VPS or Dedicated Server

Brief Description FTP data is usually insecure since information (usernames, pa
2 min read
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert

How to use phpMyAdmin to develop a website (without MySQL experience)

Brief description A web developer who is not well versed into coding websites f
2 min read
Idan Cohen
Idan Cohen
Marketing Expert

How to Install MySQL on a Windows Web Server Running Apache

This tutorial will show you how to install the MySQL database on a Windows serve
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top