How to Install Visual Studio Code on Fedora Linux

Visual Studio Code is a free code editor from Microsoft that supports debugging, syntax highlighting, intelligent code completion, and integrated Git control. Whether you write Python scripts, build web applications, or work with containers using Docker, VS Code provides the extensions and language support to handle it. By the end of this guide, you will have VS Code installed and running on Fedora, ready for your development workflow.

This guide covers two installation methods: the Microsoft RPM repository (recommended) and Flatpak from Flathub. Specifically, the RPM method provides both stable and Insiders builds with automatic updates, while Flatpak offers sandboxed isolation for the stable build only.

Choose Your Visual Studio Code Installation Method

Both methods install the same application, but they differ in update frequency, sandboxing, and available builds. The table below summarizes your options:

MethodChannelAvailable BuildsBest For
Microsoft RPM RepositoryOfficial upstreamStable + InsidersMost users who want automatic updates and access to both builds
Flatpak (Flathub)Flathub stableStable onlyUsers who prefer sandboxed applications

Recommendation: Install via the Microsoft RPM repository for the best experience. This approach gives you faster updates, access to the Insiders build for testing new features, and direct support from Microsoft. Alternatively, choose Flatpak if you specifically need application sandboxing or prefer managing applications through Flatpak.

If you prefer an open-source alternative without Microsoft telemetry, consider installing VSCodium on Fedora instead. VSCodium is a community-driven build of VS Code with telemetry disabled.

The following sections walk through each installation method. Start with the one that matches your preference.

Method 1: Install Visual Studio Code via Microsoft RPM Repository

Update Fedora Packages

Before installing VS Code, update your system packages to ensure compatibility. Open a terminal by pressing the Super key and searching for “Terminal”, then run:

sudo dnf upgrade --refresh

Add the Microsoft VS Code Repository

VS Code is not available in the default Fedora repositories. Therefore, you need to import Microsoft’s GPG signing key and add their official repository:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\nautorefresh=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null

Next, verify the repository was added successfully:

dnf repolist | grep code
code                             Visual Studio Code

Install Visual Studio Code

Two builds are available: stable (recommended) and Insiders (early access). Additionally, you can install both side-by-side if needed.

Option 1: Install VS Code Stable Build (Recommended)

sudo dnf install code

Option 2: Install VS Code Insiders Build

The Insiders build provides early access to new features and updates before they reach the stable release:

sudo dnf install code-insiders

Verify the Installation

Confirm VS Code installed correctly by checking the version:

code --version
1.106.3
e643f27bd42c1ca3b17af2b61b8c201e2cc99e81
x64

The first time you install, DNF imports the Microsoft GPG signing key automatically. Type y when prompted to confirm the key import.

Method 2: Install Visual Studio Code via Flatpak

Flatpak provides a sandboxed installation that isolates VS Code from your system. However, this method offers only the stable build.

Enable Flathub Repository

First, add the Flathub repository if not already configured:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Install Visual Studio Code from Flathub

Now install VS Code using Flatpak:

flatpak install flathub com.visualstudio.code

Then verify the installation by listing installed Flatpak applications:

flatpak list | grep -i code
Visual Studio Code    com.visualstudio.code    stable    flathub

Troubleshoot Flathub Connection Issues

If the installation fails with an error about Flathub being disabled or unavailable, check the remote status:

flatpak remotes

Should Flathub show as disabled or missing, enable it with this command:

flatpak remote-modify --enable flathub

Afterward, verify Flathub is now enabled:

flatpak remotes
Name    Options
flathub system

Finally, retry the installation command.

Fix Dev Container Permission Errors with SELinux

If you use VS Code with the Dev Containers extension on Fedora, you may encounter “Permission denied” errors when accessing workspace files inside the container. This occurs because Fedora enables SELinux by default, and container volume mounts require proper labeling to access host files.

The error typically looks like this when running commands inside the dev container:

python main.py
python: can't open file '/workspaces/myproject/main.py': [Errno 13] Permission denied

To resolve this, add the :Z SELinux relabeling option to your workspace mount. Open your .devcontainer/devcontainer.json file and add the workspaceMount property with the relabel flag:

{
    "name": "My Dev Container",
    "image": "mcr.microsoft.com/devcontainers/python:3.12",
    "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/${localWorkspaceFolderBasename},type=bind,Z",
    "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
}

The :Z option tells Podman or Docker to apply a private SELinux label to the mounted volume, allowing the container to read and write files. After adding this configuration, rebuild the dev container for the changes to take effect.

Use :Z (uppercase) for a private label when only one container accesses the workspace. Use :z (lowercase) if multiple containers need shared access to the same files. For most dev container workflows, :Z is the correct choice.

Fix Input Method Issues on Wayland

If you use an input method framework like fcitx5 or ibus for Chinese, Japanese, Korean, or other non-Latin languages, VS Code may not accept input correctly on Fedora Wayland sessions. This happens because VS Code sometimes runs under XWayland instead of native Wayland, which breaks input method integration.

To fix this, launch VS Code with the Electron Ozone platform hint set to auto:

ELECTRON_OZONE_PLATFORM_HINT=auto code

If this resolves your input method issues, make the setting permanent by adding it to your shell profile. For bash users, add this line to ~/.bashrc:

echo 'export ELECTRON_OZONE_PLATFORM_HINT=auto' >> ~/.bashrc

Alternatively, create a desktop entry override that applies the setting automatically. First, create the local applications directory if it doesn’t exist:

mkdir -p ~/.local/share/applications

Then copy and modify the VS Code desktop entry:

cp /usr/share/applications/code.desktop ~/.local/share/applications/
sed -i 's|Exec=/usr/share/code/code|Exec=env ELECTRON_OZONE_PLATFORM_HINT=auto /usr/share/code/code|g' ~/.local/share/applications/code.desktop

After creating the override, log out and back in or run update-desktop-database ~/.local/share/applications to apply the changes.

Launch Visual Studio Code

After installation, launch VS Code using either the terminal or the graphical applications menu.

Launch Visual Studio Code from Terminal

To start the stable build, run:

code

For the Insiders build, use this command instead:

code-insiders

Alternatively, for Flatpak installations, run:

flatpak run com.visualstudio.code

You can also open a project directory directly with code /path/to/project or open the current directory with code .

Launch Visual Studio Code from Applications Menu

Open VS Code from the graphical interface:

  1. Press the Super key (Windows key) to open Activities.
  2. Type “Visual Studio Code” in the search field.
  3. Click the VS Code icon to launch.

Manage Visual Studio Code

Update Visual Studio Code

VS Code updates automatically when you run system updates. For the RPM installation, use:

sudo dnf upgrade --refresh

Similarly, for Flatpak installations:

flatpak update

Remove Visual Studio Code

Remove VS Code (RPM Installation)

To uninstall the stable or Insiders build, run:

sudo dnf remove code
sudo dnf remove code-insiders

Additionally, you can remove the Microsoft repository if no longer needed:

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

Remove VS Code (Flatpak Installation)

flatpak uninstall com.visualstudio.code

Also delete the Flatpak application data:

rm -rf ~/.var/app/com.visualstudio.code

Remove User Configuration Data

The following commands permanently delete your VS Code settings, extensions, keybindings, and snippets. Export any custom configurations you want to keep before proceeding.

To completely clean up, delete the VS Code configuration and cache directories:

rm -rf ~/.config/Code ~/.config/Code\ -\ Insiders
rm -rf ~/.vscode ~/.vscode-insiders
rm -rf ~/.cache/Code ~/.cache/Code\ -\ Insiders

Closing Thoughts

You now have Visual Studio Code installed on Fedora with automatic updates configured. As a result, the RPM method gives you access to both stable and Insiders builds, while Flatpak provides sandboxed isolation if you prefer that approach.

From here, expand your development environment by installing Git for version control if you haven’t already, or explore language-specific setups like Rust or Go. Furthermore, for containerized development workflows, combine VS Code with Docker on Fedora using the Dev Containers extension.

Leave a Comment