1. Home
  2. Linux
  3. Install microsoft visual studio code on linux

How to install Microsoft Visual Studio Code on Linux

Need to get your hands on Microsoft’s Visual Studio Code on Linux but unsure about how to do it? If so, this guide can help! Follow along as we go over how to set up Visual Studio Code on Linux!

 Ubuntu instructions

Microsoft’s Visual Studio Code app works on Linux, including Ubuntu. To get the app working on your favorite Ubuntu-like Linux distribution, head over to the official VSC download page and grab the DEB package. Once you’ve got the DEB package downloaded to your computer, launch a terminal session and use the CD command to move from the home directory (~/) to the ~/Downloads folder.

Note: Visual Studio Code is only available for the 64-bit version of Ubuntu. Sadly, there isn’t a 32-bit release, and it doesn’t appear that Microsoft will ever release one.

cd ~/Downloads

In ~/Downloads, run the dpkg command. Running this command will start the package installation on your Ubuntu PC.

sudo dpkg -i code_*_amd64.deb

When the package finishes installing on your Ubuntu Linux PC, you may notice some errors. These errors don’t always happen, but when they do, you can quickly make them go away by running the apt install command with the “f” switch.

sudo apt install -f

After running the fix command, Visual Studio Code will be up and running on Ubuntu.

Debian instructions

As there is a DEB package available, Visual Studio Code will work just fine on Debian. However, if you’re a Debian user, you may need to enable the third-party software source, as it may have dependencies not found (or outdated) in the current Debian repository.

To enable the software source, launch a terminal window and gain root access by running the su command.

Note: Can’t use su? Sudo works instead!

su -

or

sudo -s

Now that you’ve got Root access in the terminal run the Curl command and download the release key.

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg

Add the Microsoft GPG key to the Root user with the install command.

install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
With the GPG key working on Debian, it's time to add the software repository.

sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

After adding the new software source to Debian, you must install the “apt-transport-https” package to your computer. It is a required package, since Microsoft’s software repository is HTTPS, and Debian can’t handle these connections out of the box.

apt-get install apt-transport-https

The HTTPS transport package is working within Apt/Apt-get. Now it’s time to run the “update” command.

apt-get update

Finally, install Visual Studio Code on your Debian Linux PC with

apt-get install code

Arch Linux instructions

Microsoft’s Visual Studio Code is available on the AUR. To install it, launch a terminal and follow the step-by-step instructions below.

Step 1: Install the Base-devel and Git packages to your Arch computer.

sudo pacman -S base-devel git

Step 2: Clone the Visual Studio Code AUR package with Git.

git clone https://aur.archlinux.org/visual-studio-code-bin.git

Step 3: CD into the code folder.

cd visual-studio-code-bin

Step 4: Compile the package and install it on your Arch Linux PC. Be sure to read the comments if you run into issues.

makepkg -sri

Fedora instructions

There’s an RPM repository for Microsoft’s Visual Code available. If you’re a Fedora user, you’ll be able to set it up. To set it up, launch a terminal window and gain root access with su.

su –

Now that you’ve got Root set up the Repo’s GPG key.

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

With the key imported, it’s time enable the Repo.

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'

Next, run the DNF update.

sudo dnf check-update

Lastly, install the program on Fedora with:

sudo dnf install code -y

OpenSUSE instructions

The RPM repository works great on Fedora, but it also works on OpenSUSE. To get it working, you must import the GPG key and add the repo to your system.

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

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

With the Repo and GPG key set up, install Visual Studio Code on OpenSUSE with the Zypper commands below.

zypper refresh

zypper install code

Flatpak instructions

Visual Studio Code is available on Flatpak, so you can install it on pretty much every Linux distribution out there. To install it, head over to our tutorial and set up the Flatpak runtime. Then enter the installation commands below.

flatpak install flathub com.visualstudio.code.oss

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Snap package instructions

Visual Studio Code is in the Snap store. To get it working, head over to our tutorial on how to enable Snapd. Then, once you’ve got it working, enter the command below to install the program.

sudo snap install vscode --classic

Comments are closed.