How to Install Visual Studio Code on Rocky Linux (10, 9, 8)

Last updated Friday, February 13, 2026 8:13 am Joshua James 7 min read

This guide covers how to install Visual Studio Code on Rocky Linux from Microsoft’s official DNF repository. The steps work identically on Rocky Linux 10, 9, and 8 and set up automatic updates through your standard package manager. The DNF package is named code (not vscode), so standard installation uses sudo dnf install code after adding the repository.

VS Code offers built-in debugging, Git integration, and a large extension ecosystem for languages and frameworks ranging from Python and C++ to Ansible and Terraform. The sections below walk through repository setup, package installation, launching, updating, and clean removal.

Update Rocky Linux Before VS Code Installation

Start by refreshing your package metadata and upgrading installed packages. Running a full upgrade before adding a third-party repository prevents dependency conflicts during the VS Code installation.

sudo dnf upgrade --refresh

Wait for the process to complete before proceeding. On a freshly provisioned system this step may pull a large number of updates.

This guide uses sudo for every command that requires root privileges. If your account is not yet in the sudoers file, run the commands as root or add your user to the wheel group first.

Install Visual Studio Code on Rocky Linux

Visual Studio Code is not available in Rocky Linux’s default repositories. The installation requires importing Microsoft’s GPG signing key, creating a repository configuration file, and then installing the package with DNF.

The Microsoft VS Code repository supports Rocky Linux 8, 9, and 10. All commands below work identically across these versions and no version-specific adjustments are needed.

Import the Microsoft GPG Key

The Microsoft GPG key authenticates packages downloaded from the repository, ensuring they have not been tampered with during transit. Import the key into your RPM keyring:

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

Unlike some third-party keys that trigger SHA-1 warnings on Rocky Linux 9 and 10, the Microsoft key imports cleanly without any crypto-policy issues. Verify the import:

rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' | grep -i microsoft

A successful import produces:

gpg-pubkey-be1229cf-5631588c	Microsoft (Release signing) <gpgsecurity@microsoft.com> public key

Create the VS Code Repository File

Create a repository file that tells DNF where to find Visual Studio Code packages and how to verify them:

printf "[vscode]\nname=Visual Studio Code\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\n" | sudo tee /etc/yum.repos.d/vscode.repo

The repo_gpgcheck=1 setting enables repository metadata verification for additional security, and metadata_expire=1h ensures DNF sees new releases within an hour of publication.

Verify the Repository

Confirm that DNF recognizes the new repository by listing all enabled repositories:

sudo dnf repolist

The output should include a vscode entry alongside the default Rocky Linux repositories:

repo id                         repo name
appstream                       Rocky Linux 10 - AppStream
baseos                          Rocky Linux 10 - BaseOS
extras                          Rocky Linux 10 - Extras
vscode                          Visual Studio Code

If the vscode entry does not appear, check the repository file syntax with cat /etc/yum.repos.d/vscode.repo and correct any formatting errors before continuing. For tips on faster package operations, see the guide on increasing DNF speed on Rocky Linux.

Choose Your VS Code Edition

Microsoft publishes two editions through the same repository. The following table summarizes the differences:

EditionPackageRelease CycleBest For
StablecodeMonthly releases with weekly patchesProduction development, team environments
Insidercode-insidersDaily buildsExtension developers, testing upcoming API changes

Both editions can coexist on the same system because they use separate binaries and configuration directories.

Install Stable Visual Studio Code

For most users, the stable edition provides the best balance of features and reliability. The package is named code in the Microsoft repository (searching for vscode will not find it). Install it with:

sudo dnf install code

DNF resolves dependencies and prompts you to confirm. On minimal Rocky Linux installations, expect several graphical libraries (GTK, graphics rendering, audio support) in the dependency list.

After installation, verify the package version:

rpm -q code
code-1.107.1-1765982492.el8.x86_64

The version number reflects the current release at the time of installation.

Install Insider Visual Studio Code

If you need daily builds with the latest features for extension development or API testing, install the insider edition instead:

sudo dnf install code-insiders

Expect occasional instability and breaking changes between insider builds. During either installation, DNF may prompt you to confirm the GPG key import if this is your first install from the Microsoft repository.

Launch Visual Studio Code on Rocky Linux

After installation, launch VS Code through the terminal or your desktop environment’s application menu.

Launch from the Terminal

Open Visual Studio Code from the command line:

code

You can also open a specific file or directory by passing it as an argument. For example, code ~/projects/myapp opens VS Code with that directory as the workspace root. If you installed the insider edition, use code-insiders instead:

code-insiders

VS Code includes built-in Git support. If Git is not yet installed on your system, see the guide on how to install Git on Rocky Linux. For GitHub workflows, the GitHub CLI on Rocky Linux pairs well with the VS Code integrated terminal.

Launch from the Applications Menu

On GNOME, press the Super key and type “code” to locate the application. Alternatively, open the full application menu and search for “Visual Studio Code.”

Update Visual Studio Code on Rocky Linux

VS Code updates arrive through the Microsoft repository and apply during standard system upgrades:

sudo dnf upgrade --refresh

To update only VS Code without upgrading other packages:

sudo dnf upgrade code

For the insider edition:

sudo dnf upgrade code-insiders

Remove Visual Studio Code from Rocky Linux

Follow these steps to cleanly remove VS Code and its associated files when you no longer need the editor.

Uninstall the VS Code Package

Remove the stable edition:

sudo dnf remove code

Or remove the insider edition:

sudo dnf remove code-insiders

DNF handles orphaned dependencies automatically, so a separate autoremove step is not typically needed.

Remove User Configuration and Data

The package removal does not delete personal settings, extensions, or cached data. VS Code stores user data in four directories:

  • ~/.config/Code — settings, keybindings, snippets, and state data
  • ~/.local/share/Code — workspaces, storage, and internal databases
  • ~/.vscode — installed extensions
  • ~/.cache/Code — cached data and logs

The following commands permanently delete your VS Code settings, extensions, and cached data. Back up anything you want to keep first: cp -r ~/.config/Code ~/vscode-backup.

Remove all user data for the stable edition:

rm -rf ~/.config/Code ~/.local/share/Code ~/.vscode ~/.cache/Code

For the insider edition:

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

Remove the Microsoft Repository

If you do not plan to reinstall VS Code, remove the repository file to prevent unnecessary metadata checks during future updates:

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

Verify the removal:

dnf repolist | grep vscode

An empty output confirms the repository is no longer active.

Troubleshoot Visual Studio Code Issues on Rocky Linux

The sections below address the most common VS Code problems on Rocky Linux with step-by-step solutions.

VS Code Fails to Start

Launch VS Code from the terminal with verbose output to capture error details:

code --verbose

Missing shared library errors typically look like this:

error while loading shared libraries: libxkbfile.so.1: cannot open shared object file: No such file or directory

Resolve missing library errors by running a full system upgrade:

sudo dnf upgrade --refresh

For permission errors, verify ownership of the VS Code configuration directories:

ls -la ~/.config/Code
ls -la ~/.vscode

If these directories are owned by root or another user, reset them:

sudo chown -R $USER:$USER ~/.config/Code ~/.vscode

Extension Conflicts and Crashes

To isolate a problematic extension, launch VS Code with all extensions disabled:

code --disable-extensions

If VS Code works normally, re-enable extensions one at a time through the Extensions panel (Ctrl+Shift+X) to identify the conflict. For persistent issues, clear all extensions and reinstall only the ones you need:

rm -rf ~/.vscode/extensions/*

Reinstall extensions from the command line using the marketplace identifier:

code --install-extension ms-python.python

Repository or GPG Key Errors

GPG signature verification failures indicate missing or incorrectly imported keys. A common error looks like:

warning: Signature not supported. Hash algorithm SHA1 not available.
error: https://packages.microsoft.com/yumrepos/vscode/repodata/repomd.xml: GPG verification failed

Verify that the Microsoft GPG key exists in your RPM keyring:

rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' | grep -i microsoft

If the key does not appear, re-import it:

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

Next, verify the repository file syntax:

cat /etc/yum.repos.d/vscode.repo

The output should match:

[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
metadata_expire=1h

Confirm the repository appears in DNF’s active list:

dnf repolist | grep vscode

If the repository does not appear, verify that enabled=1 is set and that no syntax errors exist in the configuration file.

Additional Help

If none of the above solutions resolve your issue, consult the official VS Code FAQ for additional guidance. You can also post your question on the Rocky Linux forums, where community members can provide distribution-specific assistance.

Conclusion

You now have Visual Studio Code running on Rocky Linux with automatic updates through Microsoft’s official repository. The editor supports both stable and insider editions side by side, and DNF handles all future updates alongside your regular system maintenance. For remote development workflows, consider pairing VS Code with SSH on Rocky Linux to connect to remote servers directly from the editor.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffee Buy me a coffee

Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<a href="URL">link</a> link
<blockquote>quote</blockquote> quote block

Leave a Comment

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: