How to Install Visual Studio Code (VS Code) on Linux: A Complete Guide

install Visual Studio Code on Linux

Visual Studio Code (VS Code) is a powerful, open-source code editor that supports multiple programming languages and extensions. It’s lightweight, customizable, and widely used by developers around the globe. In this lession, I’ll show you how to install VS Code on Linux

Install VS Code on Fedora/RHEL-based Systems (.rpm Package):

Step 1: Download the .rpm Package

Use the following command to download the latest VS Code RPM package:

wget https://code.visualstudio.com/sha/download?build=stable&os=linux-rpm-x64 -O vscode.rpm

Step 2: Install the Package

Install it using the dnf package manager:

sudo dnf install vscode.rpm

Step 3: Launch VS Code

Run the following command to launch VS Code:

code

Install VS Code on Ubuntu Systems:

There are two ways that you can install vscode in your ubuntu machine.

  1. With snap package
  2. With apt

Install with snap package with bellow command in terminal:

sudo snap install –classic code

That’s it. Visual Studio Code has been installed on your Ubuntu machine.

Install with apt installer.

First, update the packages typing in terminal:

sudo apt update

Second, Install those dependency:

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

Third, Import the Microsoft GPG key using the following command:

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

Fourth, Enable the Visual Studio Code repository by typing:

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

Finally, Install the vscode:

sudo apt install code

2. In RHEL, Fedora, and CentOS based distributions

We currently ship the stable 64-bit VS Code in a yum repository, the following script will install the key and repository:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'

Then update the package cache and install the package using dnf (Fedora 22 and above):

sudo dnf check-update
sudo dnf install code

Installation completed happy coding with vscode.