How to Install VSCode on Fedora Linux


Visual Studio Code is a free source-code editor made by Microsoft and can be officially installed on Fedora-based systems using the Microsoft RPM repo. In the following tutorial, you will learn how to install Visual Code Editor (VSCode) on Fedora Linux using the command line terminal and the official repository from Microsoft to ensure you always have the latest updated version.

Step 1. Update Fedora

The first step is ensuring your system is up-to-date to avoid issues during the installation and for good practice. This is done by opening your terminal and using the following command.

sudo dnf upgrade --refresh

Step 2. Install Visual Studio Code (VSCode)

Visual Studio is not included in the standard Fedora repositories by default. However, you can quickly create and import the Visual Studio official repository on your system by doing the following.

First, import the GPG key to verify the installed packages’ authenticity.

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

Next, import the repository using the following command.

printf "[vscode]\nname=packages.microsoft.com\nbaseurl=https://packages.microsoft.com/yumrepos/vscode/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc\nmetadata_expire=1h" | sudo tee -a /etc/yum.repos.d/vscode.repo

You should see the following output in your terminal if the command is copied correctly.

Example only:

[vscode]
name=packages.microsoft.com
baseurl=https://packages.microsoft.com/yumrepos/vscode/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc

Now you can install VSCode. There are three options available, and I would suggest installing the stable build for most users, but you can alternatively install the insider’s build or the exploration build.

Install VSCode stable build (Recommended)

sudo dnf install code -y

Install VSCode insiders build

sudo dnf install code-insiders -y

Install VSCode exploration build

sudo dnf install code-exploration -y

Note the first time installing VSCode; you should see the GPG key is imported.

Example:

Importing GPG key 0xBE1229CF:
 Userid     : "Microsoft (Release signing) <gpgsecurity@microsoft.com>"
 Fingerprint: BC52 8686 B50D 79E3 39D3 721C EB3E 94AD BE12 29CF
 From       : https://packages.microsoft.com/keys/microsoft.asc

Ensure the above is correct.

Step 3. Launch Visual Studio Code (VSCode)

Now that you have completed the installation, you can open the software in a few ways.

Using the command line terminal, you can open the software quickly by using the following command.

code

The best way to use VSCode for desktop users that prefer not to use the command line terminal is to open the GUI of the application by following the path.

Activities > Show Applications > Visual Studio Code

Example:

The first time you open Visual Studio, you will see the following window asking about theme options which you can always go back and customize later.

Example:

Congratulations, you have installed Visual Studio Code on Fedora.

Step 4. Additional Commands & Tips

Update Visual Studio Code (VSCode)

To check for updates using the command line, use the following command to allow a blanket check for any updates across all DNF packages.

sudo dnf update --refresh

Remove (Uninstall) Visual Studio Code (VSCode)

When you no longer want VSCode installed on your system, use the following command that matches your installation version to remove it.

Remove VSCode stable build

sudo dnf remove code

Remove VSCode insider’s build

sudo dnf remove code-insiders

Remove VSCode exploration build

sudo dnf remove code-exploration

Next, remove the repository using the following command if you plan never to re-install the IDE again.

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

Comments and Conclusion

The tutorial taught you how to import the Microsoft repository to install the latest stable Visual Studio Code (VSCode) version. I would suggest that users who do not like the elementary of Visual Studio and require the IDE editor without the plugins. Check out my tutorial on installing VSCodium on Fedora Linux.

See also
How to Install Microsoft Edge on Fedora Linux

Leave a Comment

Share to...