Visual Studio Code is a free source-code editor made by Microsoft for Windows, Linux macOS. Visual Studio Code features include support for debugging, embedded Git control, intelligent code completion, snippets, and code refactoring. Microsoft Visual Studio Code also has an extensive extension library that can further support dedicated software development and coding to enrich and help develop and use the software.
In the following guide, you will learn how to install Visual Code Editor on Fedora.
Table of Contents
- Recommended OS: Fedora Linux 34 / 35 (Newer versions will work also)
- User account: A user account with sudo or root access.
Updating Operating System
Update your Fedora operating system to make sure all existing packages are up to date:
sudo dnf upgrade --refresh -y
Create & Import Visual Studio Repository
By default, Visual Studio does not come included in the standard Fedora repositories. However, you can quickly create and import the Visual Studio official repository on your system by doing the following.
First, create and open up the repository file using any text editor:
sudo nano /etc/yum.repos.d/vscode.repo
Next, add the following so you can import the repository and install VS Code:
[vscode] name=Visual Studio Code baseurl=https://packages.microsoft.com/yumrepos/vscode enabled=1 gpgcheck=1 gpgkey=https://packages.microsoft.com/keys/microsoft.asc
Once done, save the file CTRL+O then exit with CTRL+X.
Note, this will import the GPG key also for the installation. If the GPG fails to import for some reason, import it manually using the following command:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
Install Visual Studio Code
With the source repository sorted, you must refresh your dnf package manager sources list to reflect the new addition before the Visual Studio installation. To do this, run the following command in your terminal:
sudo dnf update
Now install Visual Studio with the following command:
sudo dnf install code
Type “Y”, then press the “ENTER KEY” to proceed and complete the installation.
To confirm the installation, you can use the verify version command as follows:
1.61.0 ee8c7def80afc00dd6e593ef12f37756d8f504ea x64
How to Launch Visual Studio Code
With the installation complete, you can run Visual Studio in a few different ways. First, while you are in your terminal, you can use the following command:
Alternatively, run the code command in the background to free up the terminal:
However, this isn’t practical, and you would use the following path on your desktop to open with the path: Activities > Show Applications > Visual Studio Code. If you cannot find it, use the search function in the Show Applications menu if you have many applications installed.
The first time you open Visual Studio, you will see the following window:
Congratulations, you have installed Visual Studio Code on Fedora.
How to Update Visual Studio Code
To update VS Code, run the DNF update command in your terminal as you would check your entire system for any updates.
sudo dnf update
If one is available, use the upgrade option:
sudo dnf upgrade
Or upgrade just Visual Studio itself:
sudo dnf upgrade code
How to Remove (Uninstall) Visual Studio Code
To remove the Visual Studio software from your system, run the following command in your terminal:
sudo dnf autoremove code
Type Y, then press the ENTER KEY to proceed with the removal of Visual Studio.
Comments and Conclusion
The guide has shown you how to install Microsoft Visual Code for Fedora and add the repository to update the program without manually re-downloading and installing. Visual Code is one of the most used free IDE editors on the planet. It is also lightweight and an excellent option for your system if you run services and servers instead of using the default Linux text editors such as vim or nano.