How to Install Visual Studio Code on CentOS 8

Posted 

2 min read

Visual Studio Code is an open-source, cross-platform code editor developed by Microsoft. It has built-in debugging support, embedded Git control, syntax highlighting, code completion, integrated terminal, code refactoring, and snippets.

This article describes how to install Visual Studio Code on CentOS 8.

Prerequisites

The instructions assume that you are logged in as a user with sudo privileges.

Installing Visual Studio Code on CentOS

The easiest and recommended way to install Visual Studio Code on CentOS 8 systems is to enable the VS Code repository and install the VS Code package through the command line:

  1. Import the Microsoft GPG key:

    sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
  2. Open your text editor and create the repository file:

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

    Paste the following content to enable the VS Code repository:

    /etc/yum.repos.d/vscode.repo
    [code]
    name=Visual Studio Code
    baseurl=https://packages.microsoft.com/yumrepos/vscode
    enabled=1
    gpgcheck=1
    gpgkey=https://packages.microsoft.com/keys/microsoft.asc

    Save the file and close your text editor.

  3. Install the latest version of Visual Studio Code by typing:

    sudo dnf install code

That’s it. Visual Studio Code has been installed on your CentOS machine, and you can start using it.

Starting Visual Studio Code

Now that VS Code is installed on your CentOS system, you can launch it either from the command line by typing code or by clicking on the VS Code icon (Applications -> Programming -> Visual Studio Code).

When you start VS Code for the first time, a window like the following should appear:

You can now begin installing extensions and configuring VS Code according to your preferences.

Updating Visual Studio Code

When a new version is released you can update the Visual Studio Code package through your desktop standard Software Update tool or by running the following command in your terminal:

sudo dnf update

Conclusion

You have successfully installed VS Code on your Ubuntu 18.04 machine. Your next step could be to install Additional Components and customize your User and Workspace Settings.

To learn more about VS Code visit their official documentation page.

If you have any questions, please leave a comment below.