How to Install Visual Studio Code on Fedora 39, 38 Linux

This guide will demonstrate how to install Visual Studio Code on Fedora Linux using the command-line terminal with either the DNF Package Manager with Microsoft’s RPM or the Flatpak package manager with Flathub’s third-party repository.

Visual Studio Code is a versatile and powerful code editor that has captured the attention of developers worldwide. Its lightweight design and robust features make it an ideal choice for coding, debugging, and even web development tasks. With an array of extensions and customization options, Visual Studio Code stands out for its adaptability to various programming languages and development environments. Its user-friendly interface, coupled with a comprehensive set of tools, ensures that developers can maximize productivity and streamline their coding workflow.

Here are some key highlights of Visual Studio Code:

  • Cross-platform compatibility: Works seamlessly on Windows, macOS, and Linux.
  • Intuitive interface: Offers a clean, accessible workspace that can be customized to individual preferences.
  • Rich language support: Provides built-in support for a multitude of programming languages.
  • Powerful debugging tools: Includes an integrated debugger to help diagnose and fix issues quickly.
  • Extensible and customizable: Allows users to enhance functionality with extensions and themes.
  • Source control integration: Supports Git out of the box, making version control smoother and more integrated.
  • Intelligent code completion: Features IntelliSense, which provides smart completions based on variable types, function definitions, and imported modules.
  • Remote development capabilities: Directly enables coding on remote machines, containers, and even the Windows Subsystem for Linux (WSL) from the editor.

Now, let’s dive into the technical specifics of installing Visual Studio Code on your Fedora Linux system.

Install Visual Studio Code on Fedora Linux via RPM

Update Fedora Before Visual Studio Code Installation

Before diving into the installation process, ensuring your Fedora system is up-to-date is crucial. This practice helps avoid potential issues during the installation and keeps your system running smoothly.

To update your Fedora system, open a terminal and execute the following command:

sudo dnf upgrade --refresh

Import Visual Studio Code RPM

Visual Studio Code isn’t available by default in the standard Fedora repositories. However, you can easily set up and import the official Visual Studio Code repository on your system by following these steps:

Import VSCode GPG key:

To verify the authenticity of the installed packages, start by importing the GPG key with this command:

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

Import VSCode RPM Repository:

Next, import the repository using the command below. This command creates a new repository file with the necessary configuration to access the Visual Studio Code packages:

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

Upon successful execution, you should see the following output in your terminal:

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

With the repository in place, you can now install Visual Studio Code on Fedora Linux.

Install Visual Studio Code on Fedora Linux

There are two options available: the stable build and the insider build. For most users, we recommend installing the stable build.

Note: You can install both versions of Visual Studio Code stable and insiders build. if you like, they share separate installations.

Option 1: Install VSCode stable build (Recommended)

sudo dnf install code

Option 2: Install VSCode insiders build (upstream)

If you prefer to have access to the latest features and updates with the Visual Studio Insiders edition, you can install the insider build by running the following:

sudo dnf install code-insiders

Note: The first time you install Visual Studio Code, you should see the GPG key being imported, as shown in the example below:

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

Install Visual Studio Code on Fedora Linux via Flatpak and Flathub

This secondary section provides instructions on how to install Visual Studio Code on Fedora Linux utilizing Flatpak and the Flathub repository, showcasing an alternative to the conventional DNF method.

Enable Flathub for Visual Studio Code

First, ensure your system includes the Flathub repository, which houses various applications, including Visual Studio Code. If not already added, use the command below to add the Flathub repository to Flatpak:

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

Install Visual Studio Code via Flatpak Command

With Flatpak and Flathub now operational, advance to the installation of Visual Studio Code by dispatching the following command:

flatpak install flathub com.visualstudio.code

This command commences a search for the Visual Studio Code package within the Flathub repository and triggers its installation on your system.

Troubleshooting Flathub Activation on Fedora Linux

It might not activate as expected in some scenarios despite having imported Flathub on Fedora Linux.

To rectify this, enter the following command to enable Flathub:

flatpak remote-modify --enable flathub

Launch Visual Studio Code (VSCode) on Fedora

Congratulations on successfully installing Visual Studio Code! Now, it’s time to launch the application and explore its features. Depending on your preferences, there are several ways to open Visual Studio Code.

CLI Methods to Launch VSCode on Fedora

For those who prefer using the command line terminal, you can quickly launch Visual Studio Code with the following commands:

stable build, run the following:

code

insiders build, execute the following:

code-insiders

Alternatively, Flatpak installations need to run the alternative flatpak run command for VSCode:

flatpak run com.visualstudio.code

GUI Method to Launch VSCode on Fedora

If you’re a desktop user who prefers not to use the command line terminal, you can easily open Visual Studio Code through the GUI. Here’s how:

  1. Click on the Activities button located in the top-left corner of your screen.
  2. Select Show Applications (represented by a grid icon) to display a list of installed applications.
  3. Find and click on the Visual Studio Code icon to launch the application.
Screenshot depicting the action of launching Visual Studio Code on Fedora Linux by clicking on its icon.
Quick Launch: Click to Start Visual Studio Code on Fedora Linux

First-Time Tips with Visual Studio Code on Fedora

Now that you’ve successfully installed Visual Studio Code on Fedora, here are some first-time tips to help you get the most out of your new development environment:

General Tips for Visual Studio Code on Fedora

  • Explore the Command Palette: Use Ctrl+Shift+P to open the Command Palette, a powerful feature that provides access to nearly all commands and settings in VS Code.
  • Customize the Theme: Personalize your workspace by changing the theme. Access this through File > Preferences > Color Theme.
  • Utilize the Integrated Terminal: Open an integrated terminal within VS Code using Ctrl+`. This allows you to run shell commands without leaving the editor.
  • Extensions: Enhance your VS Code functionality by installing extensions. Access the Extensions view by clicking on the Extensions icon on the Sidebar or pressing Ctrl+Shift+X.

Customization Tips

  • Font and Display: Adjust the editor’s font size and zoom level to suit your preferences via File > Preferences > Settings.
  • Keyboard Shortcuts: Customize keyboard shortcuts through File > Preferences > Keyboard Shortcuts to streamline your workflow.
  • File Auto Save: Enable auto-save to automatically save your changes after a delay or when the focus changes by accessing File > Auto Save.
  • Workspaces: Utilize workspaces to group related projects and settings, making it easier to switch between different tasks.

Keyboard Shortcuts

  • Quick Open: Press Ctrl+P to quickly open files.
  • Toggle Sidebar Visibility: Use Ctrl+B to hide or show the Sidebar.
  • Go to File: Navigate to files faster using Ctrl+G and entering the line number.
  • Quick Fix: Ctrl+. provides quick fix suggestions for errors or warnings in your code.

Development Tips

  • Code Snippets: Use built-in snippets or create your own to speed up coding.
  • Debugging: Utilize the integrated debugger for a streamlined debugging experience. Set breakpoints, inspect variables, and analyze call stacks right from the editor.
  • Git Integration: Leverage built-in Git support for version control. Track changes, commit, push, and pull without leaving the editor.
  • Live Share: Collaborate in real-time with other developers using the Live Share extension, allowing shared editing and debugging.

Performance Optimization

  • Disable Unnecessary Extensions: Improve VS Code’s performance by disabling or uninstalling extensions that are not in use.
  • Exclude Large Folders: Use the files.watcherExclude setting to prevent VS Code from watching large folders that can slow down the editor.
  • Adjust Memory Allocation: For large projects, consider increasing the memory allocation for VS Code to enhance performance.
  • Utilize Code Minimap: Enable the Minimap for a high-level overview of your code, which can be turned on in the View menu.

Integrating these tips into your daily workflow, you’ll be able to harness the full potential of Visual Studio Code on your Fedora system, making your development process more efficient and enjoyable.

Screenshot confirming the successful installation of Visual Studio Code on Fedora Linux.
Installation Success: Visual Studio Code Ready to Use on Fedora Linux

Additional Visual Studio Code Commands with Fedora

This section will explore useful commands to update, remove, and manage Visual Studio Code on your Fedora Linux system.

Update Visual Studio Code

It’s essential to keep Visual Studio Code up-to-date for the best performance and security. To check for updates across all DNF packages, including Visual Studio Code, use the following command:

sudo dnf update --refresh

Alternatively, for the Flatpak equivalent command to blanket check all Flatpak installations for updates, run the following command:

flatpak update

Remove Visual Studio Code

DNF Remove Method For Visual Studio Code

Suppose you no longer need Visual Studio Code or wish to switch to a different version. In that case, you can uninstall it using the appropriate command based on your installation:

sudo dnf remove code
sudo dnf remove code-insiders

If you’re sure you won’t reinstall Visual Studio Code in the future, you can also remove the repository from your system. To do this, execute the following command:

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

Flatpak Remove Method For Visual Studio Code

Alternatively, if you installed VSCode utilizing Flatpak, use the following command to remove it:

flatpak uninstall com.visualstudio.code

Closing Thoughts

We’ve walked through the steps of installing Visual Studio Code on Fedora, from using the command-line terminal to exploring first-time tips to kickstart your development journey. Remember, the power of VS Code lies in its flexibility and customization options, so don’t hesitate to personalize your workspace and explore the vast array of extensions available. Keep experimenting with the features and settings to find what works best for your coding style. Happy coding, and enjoy the efficiency and simplicity that Visual Studio Code brings to your development projects on Fedora!

Leave a Comment


Your Mastodon Instance
Share to...