Installing VS Code on Fedora
VS Code is one of the most popular code editors out there, and it is only natural that you look for it after a fresh installation of Fedora.
Now, there are two ways to get VS Code on Fedora:
- Unofficial Flatpak package: Easy to install from the software center. However, Flatpak apps run in sandboxed containers. So, you’ll have to make additional effort to access SDKs on your actual system.
- Official RPM package: VS Code offers a YUM repository for Fedora and Red Hat systems. The application is installed on the system and is well integrated. It requires running a few commands in the terminal, though.
You can use either method and see which one suits you better.
Let me show the steps for both methods in detail.
Method 1: VS Code in Flatpak format
This is rather the easier method here. Fedora comes with Flatpak baked in. So, you could just run this command and get done with it.
flatpak install https://flathub.org/repo/appstream/com.visualstudio.code.flatpakref
Or, if you don’t like the terminal, open the software center and look for VS Code and install it from there. Just a matter of a few clicks.
The screenshots are shown for GNOME desktop environment. If you are using KDE or some other desktop environment, use their software center. The screenshots may look different but the steps remain the same.
Open the Software Center.
Look for VS Code here. You’ll see more than one results. The first one, Visual Studio Code, is the one from Microsoft. Code – OSS is the same but in its open source format, instead of what Microsoft offers. Similar is the case with VSCodium.
You’ll find the option to install Visual Studio Code. Click on it and it will be installed.
Since it is a sandboxed application, you won’t be asked to provide your account password while installing this program. However, you’ll see a warning that extra effort is required for accessing some SDKs.
Removal steps
To remove, use the following command:
flatpak uninstall code
Alternatively, you can also just go to Software Center, look for VS Code again and uninstall it from there.
The Flatpak version works good for me. But if you don’t like its sandboxed behavior and you are not comfortable with the extra steps required for setting your development environment, you can opt for the native RPM package.
Method 2: VS Code in native RPM package
Microsoft provides a YUM repository that allows you to install VS Code on Fedora and update it with system updates when a newer version is available.
First, you need to import the repository signing key into your system:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
Next, add the repository to your system using this command:
sudo sh -c 'echo -e "[code]nname=Visual Studio Codenbaseurl=https://packages.microsoft.com/yumrepos/vscodenenabled=1ngpgcheck=1ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
The above command may look scary but that’s what the official document mentions. Basically, you are creating a file /etc/yum.repos.d/vscode.repo
and adding some text that has repository information in a specific format. n
is used for adding new line.
Now that repo is added, refresh the package cache so that your system knows about the availability of the new package.
dnf check-update
Everything is set now. You can install Visual Studio Code now with this command:
sudo dnf install code
You’ll have to press Y to confirm your choice:
Removal steps
To uninstall the RPM version of VS Code, use the following command:
sudo dnf remove code
Do more with VS Code
I find it surprising that Microsoft has managed to name VS Code as code on all the platforms.
Anyway, it’s good to see that Fedora has a few ways of installing VS Code and it’s not that complicated.
I presume you’ll be using GitHub so it’s better to integrate it directly in VS Code.
Master the keyboard shortcuts to feel like the VS Code champion.
Happy coding with (VS) Code 👩💻