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.
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
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 –
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"
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
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.
When you start visual studio code first time on your Linux system, the following interface displays on the desktop:
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
Finally, after adding the GPG key details use the following command to install visual studio code:
$ sudo dnf install code
Once the VS code installation is completed, launch it by using the application menu or by using the 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
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.
- Your query to the best web hosting can end by clicking on this link.