How to Install Visual Studio Code on Fedora 39/38/37 Linux

Welcome to the world of Visual Studio Code, or VSCode, a powerful and versatile code editor that offers a multitude of features catering to the needs of both personal and professional users. Developed by Microsoft, VSCode has rapidly become a favorite among developers due to its vast array of extensions, superb integration capabilities, and customization options. This introduction highlights some of the key aspects that make VSCode a popular choice for Fedora users and beyond.

Key Advantages of Visual Studio Code:

  • Cross-platform: VSCode is available on multiple platforms, including Windows, macOS, and Linux, making it an excellent choice for Fedora users looking for a consistent coding experience across different operating systems.
  • Extensibility: The impressive range of available extensions allows users to enhance the editor’s functionality and tailor it to their specific needs. Extensions can provide support for various programming languages, debuggers, linters, and other tools.
  • Customizable Interface: Users can personalize their workspace with themes, keyboard shortcuts, and editor settings to create a unique and productive environment.
  • Integrated Terminal: The built-in terminal allows developers to run commands, scripts, and tasks without leaving the editor, streamlining the development workflow.
  • Git Support: VSCode offers robust Git integration, allowing developers to manage their repositories, stage changes, and resolve conflicts directly from the editor.
  • Language Server Protocol: Through the Language Server Protocol, VSCode provides IntelliSense, code completion, and refactoring capabilities for a wide variety of programming languages.
  • Live Share: Collaborate in real-time with other developers, regardless of their operating system, by sharing a coding session via the Live Share extension.

Whether you’re a seasoned professional or just starting your coding journey, VSCode is an invaluable tool that adapts to your needs and workflow preferences. By leveraging the power of its extensions and customization options, you’ll be well-equipped to tackle any coding project, big or small.

The following guide will now demonstrate how to install Visual Studio Code on Fedora Linux, offering a comprehensive step-by-step process to get you started with this fantastic code editor. Stay tuned to unlock the potential of VSCode and elevate your coding experience to new heights.

Section 1: Install Visual Studio Code

Step 1: Update Fedora

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

Step 2: Import Visual Studio Code RPM

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

Import the 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

Add the 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 proceed to install Visual Studio Code. There are two options available: the stable build and the insiders build. For most users, we recommend installing the stable build.

Step 3: Install Visual Studio Code stable or insiders

Install VSCode stable build (Recommended)

sudo dnf install code -y

Install VSCode insiders build

If you prefer to have access to the latest features and updates, you can install the insiders build by running the following:

sudo dnf install code-insiders -y

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

Ensure the output matches the example to confirm that the correct GPG key is imported.

Section 2: Launch Visual Studio Code (VSCode)

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.

Step 1: Launch VSCode using the command line

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

For the stable build, run the following:

code

For the insiders build, execute:

code-insiders

These commands will open the respective versions of Visual Studio Code, allowing you to start coding immediately.

Step 2: Launch VSCode using the graphical user interface (GUI)

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.

Example of Visual Studio Code on the Fedora Linux application menu:

Section 3: Getting Started with Visual Studio Code on Fedora Linux

Now that you’ve installed Visual Studio Code on your Fedora Linux system, it’s time to explore its powerful features, customizations, and tools. The following tips will help you get started with this versatile code editor on Fedora Linux.

Tip 1: Install Extensions for Enhanced Functionality

Visual Studio Code offers a vast library of extensions to enhance your development experience. To install extensions, follow these steps:

  1. Click on the Extensions icon in the Activity Bar on the side of the window.
  2. Search for the desired extension in the search bar.
  3. Click Install to add the extension to Visual Studio Code.

Some popular extensions for Fedora Linux users include:

  • Live Share: Collaborate in real-time with other developers.
  • GitLens: Supercharge your Git capabilities within VSCode.
  • Prettier: Automatically format your code to improve readability.

Tip 2: Customize the User Interface

Personalize your Visual Studio Code environment by customizing the user interface. Some options include:

  • Change the color theme: Go to File > Preferences > Color Theme and choose from a variety of preinstalled themes.
  • Configure the font: Adjust the font size, family, and style by opening the settings JSON file (File > Preferences > Settings > Open Settings (JSON)) and adding or modifying the relevant properties.

Tip 3: Configure Keyboard Shortcuts

Maximize your productivity by customizing keyboard shortcuts. To do this, go to File > Preferences > Keyboard Shortcuts. You can search for specific commands and assign your preferred key combinations.

Tip 4: Utilize Integrated Terminal

Visual Studio Code comes with an integrated terminal, making it easier to run commands and scripts without switching windows. To open the terminal, use the Ctrl + ` shortcut, or go to View > Terminal in the menu.

Tip 5: Set Up Version Control with Git

Visual Studio Code has built-in support for Git, a popular version control system. To start using Git, follow these steps:

Install Git on Fedora Linux with the command:

sudo dnf install git -y

Configure your Git user name and email with the following commands:

git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"

Initialize a new Git repository or clone an existing one within Visual Studio Code.

Example of Visual Studio Code default UI when first launched on Fedora Linux:

Section 4: Additional Visual Studio Code Commands with Fedora Linux

In this section, we’ll explore some useful commands to update, remove, and manage Visual Studio Code on your Fedora Linux system.

Step 1: 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

This command will ensure that all installed packages on your system are updated to the latest available versions.

Step 2: Remove Visual Studio Code

If you no longer need Visual Studio Code on your system or wish to switch to a different version, you can uninstall it using the appropriate command based on your installation:

Remove VSCode stable build:

sudo dnf remove code

Remove VSCode insider’s build:

sudo dnf remove code-insiders

Step 3: Remove Visual Studio Code Repository

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

Closing Thoughts on Installing Visual Studio Code on Fedora Linux

Throughout this article, we have discussed the steps to install, update, and manage Visual Studio Code (VSCode) on your Fedora Linux system. Following these guidelines will ensure a smooth experience with this powerful code editor. Remember that keeping your software up-to-date is crucial for security and performance reasons.

For those who may be concerned about telemetry data collection, you might consider using VSCodium as an alternative to Visual Studio Code. VSCodium is a community-driven, telemetry-free version of VSCode that maintains the same features and functionality but with enhanced privacy.

Additional Resources and Links

To help you further explore Visual Studio Code and its capabilities, here are some official resources that can provide valuable information:

  • Official Visual Studio Code Website: This is the home page for Visual Studio Code, where you can find the latest news, updates, and download links for various platforms.
  • Visual Studio Code Documentation: This comprehensive documentation covers various topics, from getting started to advanced customization, extensions, and troubleshooting.
  • Visual Studio Code GitHub Repository: This is the official GitHub repository for Visual Studio Code, where you can explore the source code, report issues, and contribute to the project.

Share to...