Install VSCode on Fedora 40

Install VSCode on Fedora 40

Learn how to install VSCode on Fedora 40 with our easy, step-by-step guide. Follow RPM and repository installation methods, CLI examples, and troubleshooting tips for a seamless setup.

Table of Contents

Introduction

Visual Studio Code (VSCode) is a powerful, free source-code editor developed by Microsoft, designed to support a wide array of programming languages and frameworks. In this guide, we’ll go through the steps to install VSCode on Fedora 40 Workstation Edition, covering both the official and repository-based installation methods. This comprehensive tutorial ensures you get the latest version of VSCode up and running with minimal effort. We’ll also include table charts and CLI examples to make your setup as efficient as possible.

Prerequisites

Before installing VSCode on Fedora 40, ensure that your system meets the following prerequisites:

RequirementDescription
Fedora OS VersionFedora 40
User PrivilegesSudo privileges (for package management)
Internet ConnectionNeeded to download packages and dependencies

Installing VSCode on Fedora 40

There are two primary ways to install Visual Studio Code on Fedora 40:

  1. Using the RPM package provided by Microsoft.
  2. Setting up the VSCode repository, which enables easy updates.

Installing via RPM Package

The RPM package provides a straightforward way to install VSCode. Follow these steps:

Download the Latest VSCode RPM Package

Open your terminal and download the VSCode package using the following command:

				
					curl -L "https://code.visualstudio.com/sha/download?build=stable&os=linux-rpm-x64" -o vscode.rpm
				
			
Install VSCode on Fedora 40

Photo by admingeek from Infotechys

Install the RPM Package

Use the dnf package manager to install the downloaded package.

				
					sudo dnf install ./vscode.rpm
				
			
Install VSCode on Fedora 40

Photo by admingeek from Infotechys

Confirm Installation

To verify that VSCode has been installed, you can run the following command to check the installed version:

				
					code --version
				
			
				
					1.94.2
384ff7382de624fb94dbaf6da11977bba1ecd427
x64
				
			

Installing via Repository

Installing VSCode via its official repository is recommended for long-term use, as it makes updates easier.

Add the Microsoft Repository

Microsoft offers an official repository for VSCode, which can be added by creating a .repo file.

				
					sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
				
			
				
					sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
				
			
Install VSCode on Fedora 40

Photo by admingeek from Infotechys

Install VSCode Using DNF

Now, install VSCode from the repository.

				
					sudo dnf install code
				
			
Fedora 40: Alternate Install with Microsoft VSCode Repository Enabled

Photo by admingeek from Infotechys

Verify the Installation

Check that VSCode was successfully installed by running:

				
					code --version
				
			

If installed correctly, this command will output the version number of VSCode, confirming a successful setup. Here’s a summary of both methods:

MethodCommandsAdvantages
RPM Packagecurl -L “https://code.visualstudio.com/sha/download?build=stable&os=linux-rpm-x64” -o vscode.rpm
sudo dnf install ./vscode.rpm
Quick installation
Official Repositorysudo rpm –import https://packages.microsoft.com/keys/microsoft.asc

sudo sh -c ‘echo -e “[code]
name=Visual Studio Code
baseurl=https://packages.microsoft.com/yumrepos/vscode
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc” > /etc/yum.repos.d/vscode.repo’

sudo dnf install code
Automatic updates via dnf

Launching VSCode

After installation, VSCode can be launched in a few different ways:

Via Terminal:

				
					code
				
			

Through the Application Menu:

  • Open your application launcher (Gnome Activities or KDE Menu).
  • Search for “Visual Studio Code” and click to open.
Launching VS Code: Gnome Activities

Photo by admingeek from Infotechys


Optional Configuration

Now that VSCode is installed, you may want to customize your environment with extensions, themes, and other configurations.

Installing Extensions

VSCode extensions allow for enhanced development experiences. Here are some popular ones:

ExtensionPurposeInstallation Command
PythonPython development toolscode --install-extension ms-python.python
C/C++C/C++ language supportcode --install-extension ms-vscode.cpptools
Prettier – Code FormatterCode formattingcode --install-extension esbenp.prettier-vscode

To install an extension, use:

				
					code --install-extension <extension-id>
				
			

For example, to install Python support:

				
					code --install-extension ms-python.python
				
			
				
					Installing extensions...
Installing extension 'ms-python.python'...
Extension 'ms-python.debugpy' v2024.12.0 was successfully installed.
Extension 'ms-python.python' v2024.16.1 was successfully installed.
Extension 'ms-python.vscode-pylance' v2024.10.1 was successfully installed.
				
			

Configuring Themes

To change themes:

  1. Launch VSCode.
  2. Go to File > Preferences > Color Theme.
  3. Choose a theme that fits your preferences.
Install VSCode on Fedora 40

Photo by admingeek from Infotechys

Alternatively, you can click the Browse Color Themes button on the welcome screen to explore a variety of light and dark themes. For additional themes, install them from the marketplace, such as the popular “One Dark Pro” theme:

				
					code --install-extension zhuangtongfa.material-theme
				
			
				
					Installing extensions...
Installing extension 'zhuangtongfa.material-theme'...
Extension 'zhuangtongfa.material-theme' v3.17.5 was successfully installed.
				
			

Troubleshooting

If you encounter any issues during installation, here are some troubleshooting tips:

Problem: code: command not found

Solution: Make sure the installation completed successfully. Restart your terminal or log out and log back in to apply the PATH changes.

Problem: GPG key not found

Solution: Verify that the GPG key was imported correctly with the following command:

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

Conclusion

Congratulations! You’ve successfully installed VSCode on Fedora 40. With this versatile and powerful editor, you’re now equipped to dive into any project, whether it’s web development, data science, or systems programming. VSCode’s repository integration also means you’ll stay updated effortlessly. Whether you’re a beginner or a seasoned developer, VSCode’s lightweight, modular design makes it one of the best editors for any coding environment.

Did you find this article useful? Your feedback is invaluable to us! Please feel free to share your thoughts in the comments section below and share this post!


Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *