How to Install Visual studio code on OpenSUSE

Endrit Qerreti

Endrit Qerreti

Visual studio code can be installed on OpenSUSE by using the terminal. The process of installation is very simple, basically you import the microsoft key first, add the vscode repository and then install vscode.

In this tutorial, you will learn how to install visual studio code on OpenSUSE.

Step 1 - Update OpenSUSE repositories

First, you need to ensure that all packages on your system are up to date. Launch your terminal, and run the following command below to check for updates

sudo zypper refresh

You will see a similar output on your terminal if there are no packages to be updated

Step 2 - Import Microsoft Key

Next, you need to import the Microsoft key to your system. Importing Microsoft key is easy, all you have to do is launch terminal, and enter the command below

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

Once Microsoft key has been imported on your system, you can now proceed to the next step.

Step 3 - Add Vscode Repository

Now that you have added the Microsoft key on your system, proceed to add the vscode repository to your system. This repository is the server from where vscode package is going to be downloaded from.

On your terminal, run the command below to do this

sudo 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'

What the command above does, is that it creates a new directory called vscode.repo in /etc/zypp/respos.d

For example, to verify that the vscode repository file has been created on the repository directory on your computer, run

cat /etc/zypp/repos.d/vscode.repo

And you should see the content of the vscode.repo file

Step 4 - Refresh package cache

After importing microsoft key, and adding vscode repository on your system, now you need to refresh the package cache to ensure that the vscode repository can be used to download vscode package.

Update the package cache, and on the output you should see "Retrieving repository : Visual Studio Code", this message means that the repository of vscode has been successfully added on your system, and it can now be used to install vscode.

sudo zypper refresh

Step 5 - Install Visual Studio Code

Finally, you can install Visual Studio Code.

sudo zypper install code

On continue prompt, press y and then enter to confirm the installation of vscode. And the downloading process should begin

Once vscode package has been downloaded, the installation process will begin

When vscode installation is completed, the status from <100%>[\] will change to [done]

Step 6 - Use Visual Studio Code

You should be good to go and use Visual Studio Code now. Visual studio code will be added on your applications menu, to launch it smply click over "Activities" and search for "vscode" in the search box

Conclusion

By now you should have Visual studio code installed on your machine.