How to Install Visual Studio Code on Rocky Linux EL9 or EL8

Visual Studio Code (VSCode) is a beacon for developers searching for an efficient and feature-rich code editor. This guide is tailored to demonstrate how to install Visual Studio Code (VSCode) on Rocky Linux 9 and its predecessor, Rocky Linux 8. As a product of Microsoft, VSCode has carved a niche for itself, offering functionalities that elevate it above many conventional editors.

Key Attributes of Visual Studio Code:

  • Open Source Nature: VSCode’s open-source foundation fosters community-driven enhancements and the creation of diverse extensions.
  • Universal Compatibility: Its cross-platform design ensures that VSCode delivers a consistent experience across Windows, Linux, and macOS.
  • Rich Marketplace: Users can tap into a vast repository of extensions and themes, enhancing their development environment and workflow.
  • Integrated Tools: Including an integrated terminal and debugger within VSCode eliminates the need for toggling between different applications during development.
  • Code Efficiency: VSCode elevates coding efficiency with intelligent code completion, syntax highlighting, and intuitive code navigation.
  • Git Integration: Built-in Git support streamlines version control, making it more intuitive and efficient.

Transitioning to VSCode on Rocky Linux can significantly optimize your development process. This guide will provide a comprehensive walkthrough, ensuring a smooth installation and setup of Visual Studio Code on your Rocky Linux system. Whether setting up a new development environment or migrating to a more robust editor, the subsequent sections will equip you with the necessary insights. Let’s embark on this journey.

Section 1: Install Visual Studio Code on Rocky Linux

Step 1: Update Rocky Linux Before VSCode Installation

Before installing Visual Studio Code (VSCode), updating the system packages on Rocky Linux to their latest versions is imperative. This step ensures compatibility and security. To update the system packages, open the Terminal and execute the following command:

sudo dnf upgrade --refresh

Step 2: Set Up Visual Studio Code Repository on Rocky Linux

VSCode is not available in the default Rocky Linux repositories. Therefore, you must set up the official Microsoft repository for Visual Studio Code. Start by importing the Microsoft GPG key, which is used to verify the authenticity of the packages:

sudo rpm --import

Next, create a repository file for Visual Studio Code. This file tells the package manager where to find the VSCode packages. Run the following command to create and configure the repository file:

printf "[vscode]\\nbaseurl=\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=\nmetadata_expire=1h" | sudo tee -a /etc/yum.repos.d/vscode.repo

Upon running the above command, you should see an output indicating that the repository file has been created.

Now you can install VSCode. There are two options available, and I would suggest installing the stable build for most users, but you can alternatively install the insider’s build for those wanting the latest upstream version.

Step 3: Install Visual Studio Code on Rocky Linux

Now that the repository is set up, you can proceed with installing Visual Studio Code. Two builds are available – stable or the insider build. The stable build is recommended for most users as it’s thoroughly tested and reliable.

Install the stable build by running the following:

sudo dnf install code

The insider build is available for those who wish to use cutting-edge features at the potential cost of stability. Install it using the following:

sudo dnf install code-insiders

During the installation, you will be prompted to import GPG keys. Make sure the details match the following before selecting ‘yes’:

Importing GPG key 0xBE1229CF:
 Userid     : "Microsoft (Release signing) <>"
 Fingerprint: BC52 8686 B50D 79E3 39D3 721C EB3E 94AD BE12 29CF
 From       :

With these steps completed, Visual Studio Code is now installed on your Rocky Linux system and ready for use.

Section 2: Launching Visual Studio Code on Rocky Linux

Launching VSCode through Terminal

After successfully installing Visual Studio Code, it’s time to launch the application. This method is swift and efficient for developers and professionals who frequently work in a terminal. There are commands associated with each build of VSCode, and you should use the one corresponding to the build you installed.

For the stable build, execute the following command:


For the insider build, use this command instead:


Launching VSCode through Graphical User Interface (GUI)

For those who are more comfortable using a graphical interface or perhaps not working with the terminal frequently, you can also launch VSCode through the desktop environment. This method is straightforward:

  1. Click on Activities, located usually at the top left corner of your desktop.
  2. Choose Show Applications, often represented with a grid of dots.
  3. Search for “Visual Studio Code” followed by the version (stable or insider) you installed.
  4. Click on the Visual Studio Code icon to launch the application.
Screenshot demonstrating how to launch Visual Studio Code on Rocky Linux 9 or 8.Pin
Step-by-step screenshot guide on launching Visual Studio Code on Rocky Linux.

Section 3: Tips for Getting Started with Visual Studio Code on Rocky Linux

Navigating a new coding environment can be daunting. Here are some tips to help you smoothly transition into using Visual Studio Code on Rocky Linux or any Linux-based system.

Tip 1: Familiarize Yourself with Integrated Terminal

Visual Studio Code provides an integrated terminal directly within the application. This is immensely beneficial as it allows you to execute shell commands without toggling between the code editor and a separate terminal window. To open the integrated terminal, use the shortcut Ctrl + ` or go to View -> Terminal from the top menu.

Tip 2: Make Use of Extensions

One of the strengths of Visual Studio Code is its support for extensions. These are add-ons that enhance the functionality and features of the editor. For instance, you might want an extension that supports a specific programming language or a tool that helps with code formatting. To browse and install extensions, click on the Extensions icon in the Activity Bar on the side of the window or use the shortcut Ctrl + Shift + X.

Tip 3: Customize Your Workspace

Tailoring the workspace to your preference can significantly boost productivity. You can modify the theme and the layout and create workspace-specific settings. To change the theme, go to File -> Preferences -> Color Theme. Additionally, you can search for new themes in the Extensions view.

Tip 4: Utilize Keyboard Shortcuts

Mastering keyboard shortcuts is key to speeding up your workflow. Visual Studio Code has a plethora of shortcuts that can perform a variety of actions. You can view a list of keyboard shortcuts by pressing Ctrl + K followed by Ctrl + S, or by navigating to File -> Preferences -> Keyboard Shortcuts.

Tip 5: Version Control Integration

Visual Studio Code integrates seamlessly with various version control systems, with Git being the most prominent. It allows you to stage, commit, and pull from repositories without leaving the editor. Ensure that Git is installed on your system, and then initialize a repository by clicking on the Source Control icon in the Activity Bar or using the shortcut Ctrl + Shift + G.

Tip 6: Leverage Multi-Root Workspaces

When working on a project involving multiple codebases, Visual Studio Code’s multi-root workspaces can be incredibly helpful. You can add folders to your workspace and work with them as a single unit, each with its own configuration and preferences.

Tip 7: Use the Debugging Feature

Debugging is an integral part of the development process. Visual Studio Code has an in-built debugger that helps you diagnose issues inside the editor. Click on the Debug icon in the Activity Bar to start debugging, or use the shortcut Ctrl + Shift + D.

By taking advantage of these tips and the robust features of Visual Studio Code, you will find that your coding experience on Rocky Linux or any Linux-based system becomes much more efficient and enjoyable.

Screenshot showing theme selection during Visual Studio Code startup on Rocky Linux 9 or 8.Pin
How to choose your preferred theme in Visual Studio Code upon startup on Rocky Linux.

Section 4: Managing Visual Studio Code on Linux

In this section, we’ll dive into some essential commands that will help you effectively manage Visual Studio Code (VSCode) on a Linux system.

Updating Visual Studio Code

Why Update?

It is crucial to keep your software updated, as updates often include performance improvements, new features, and security patches.

Performing the Update

Once installed on a Linux system via the package manager, Visual Studio Code can be updated along with other software packages. In Linux systems that use the DNF package manager, such as Fedora, CentOS, or Rocky Linux, the following command can be used to update all the software, including Visual Studio Code:

sudo dnf upgrade --refresh

This command updates the package database and upgrades all the installed packages. If you want to update Visual Studio Code exclusively, you can use this command:

sudo dnf upgrade code

Uninstalling Visual Studio Code

When to Uninstall?

There might be instances where you need to uninstall Visual Studio Code; perhaps you want to reinstall it, or maybe it’s no longer needed.

Removal Process

To uninstall Visual Studio Code, use the following command:

sudo dnf remove code

If you have other versions of Visual Studio Code installed, such as the Insiders version you can remove them using the following command to remove this version:

sudo dnf remove code-insiders

Remove Visual Studio Code RPM Repository

After uninstalling, if you’re sure you won’t be reinstalling Visual Studio Code, removing the repository that was added during the installation is a good practice. This prevents the system from checking for updates for software that’s no longer installed. Execute the following command to remove the repository:

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


Throughout this article, we have embarked on a comprehensive journey detailing the installation of Visual Studio Code on Rocky Linux 9 or Rocky Linux 8. We started with the fundamentals of installation, moved on to launching the application, and then navigated through some tips for getting started. Furthermore, we discussed managing Visual Studio Code by efficiently updating and uninstalling the software.

Keeping Visual Studio Code up-to-date is highly recommended to avail yourself of the latest features and security patches. By comprehending and applying the knowledge shared in this guide, developers can ensure a smooth and productive coding experience on Rocky Linux systems with Visual Studio Code. Remember, a well-maintained development environment is an essential asset for any programmer.

Share to...