Are you ready to install Visual Studio Code on Rocky Linux 9 or 8? This step-by-step guide will walk you through the entire process, making it easy to set up VS Code—one of the most popular, open-source code editors—on your Rocky Linux system. Whether you’re a developer, sysadmin, or Linux enthusiast, you’ll learn how to get VS Code running smoothly and discover why it’s a top choice for coding on Rocky Linux.
Visual Studio Code brings powerful tools for coding, debugging, and Git integration, all optimized for the stability and performance of Rocky Linux. Especially in enterprise or cloud environments, VS Code’s flexibility and rich extension ecosystem make it an essential part of any modern development workflow.
By the end of this guide, you’ll have Visual Studio Code installed and customized to fit your development needs—plus tips for keeping it up to date and troubleshooting common issues.
Why Choose Visual Studio Code on Rocky Linux?
Visual Studio Code is designed for speed and efficiency, making it a perfect fit for Rocky Linux—even on systems with limited resources. Its extensible platform lets you add tools for Bash scripting, Python, Docker, and more, so you can tailor your development environment to your needs. Whether you’re a developer or sysadmin, VS Code’s flexibility and performance make it a top choice for Rocky Linux users.
Key Features for Rocky Linux Users
- Intelligent Code Completion: Advanced suggestions for faster, more accurate coding.
- Integrated Debugging: Set breakpoints, inspect variables, and troubleshoot with ease.
- Built-in Git Integration: Manage version control directly within the editor.
- Customizable Extensions: Expand functionality for Linux workflows, including Docker and language support.
- Optimized for Linux: Efficient resource usage ensures smooth operation on Rocky Linux.
Whether you’re developing locally or managing cloud-based projects, these features help you stay productive and efficient on Rocky Linux.
Update Your Rocky Linux System
Before installing Visual Studio Code, it’s essential to update your system. This ensures that all system components are up-to-date and minimizes potential conflicts during the installation process.
Note: The commands and steps in this guide are compatible with both Rocky Linux 9 and Rocky Linux 8 unless specified otherwise.
To update your Rocky Linux system, open a terminal and run the following command:
sudo dnf upgrade --refresh
This command updates the repository metadata and upgrades all installed packages to their latest versions. Wait for the process to complete before proceeding to the next step.
Add the Visual Studio Code Repository on Rocky Linux
Visual Studio Code is not included in Rocky Linux’s default repositories. To install it, you need to add Microsoft’s official repository.
Adding the official Microsoft repository ensures that you receive the latest updates and security patches directly from the source, keeping your VS Code installation current and secure.
Import the Microsoft GPG Key
The Microsoft GPG key authenticates the packages you’ll download and ensures they are secure. Use this command to import the key:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
This step is crucial to ensure the integrity of the Visual Studio Code packages.
Create the Repository File
Next, create a repository file pointing to Microsoft’s server. Run the following command:
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" | sudo tee /etc/yum.repos.d/vscode.repo
This command creates a configuration file named vscode.repo
in the /etc/yum.repos.d/
directory. It allows the DNF package manager to access the repository for Visual Studio Code.
Verify the Repository
After creating the repository, verify that it has been added successfully by running:
sudo dnf repolist
If the repository is set up correctly, you’ll see an entry labeled vscode
. Once confirmed, you can proceed to the installation.
Install Visual Studio Code on Rocky Linux
After setting up the repository, you can install Visual Studio Code using the DNF package manager.
Microsoft offers two main versions of Visual Studio Code that you can install on Rocky Linux. Here’s a quick comparison to help you choose:
- Stable Version (
code
): Recommended for most users. It provides reliable performance, well-tested features, and is suitable for daily development work. - Insider Version (
code-insiders
): For users who want access to the very latest features and updates. This version is updated more frequently but may occasionally be less stable than the stable release.
Choose the version that best suits your needs. You can even install both side-by-side if you wish, as they use different configuration directories.
Install Stable Visual Studio Code on Rocky Linux
The stable version is recommended for most users. It provides reliable performance and features. To install it, use this command:
sudo dnf install code
Install Insider Visual Studio Code on Rocky Linux
If you prefer the latest features, you can install the insider version. Be aware that this version may be less stable. Use the following command to install:
sudo dnf install code-insiders
During the installation, the system may prompt you to confirm the import of GPG keys. Review the details to ensure they match the Microsoft key.
How to Launch Visual Studio Code on Rocky Linux
After installation, you can launch Visual Studio Code either through the terminal or a graphical interface.
Launch from the Terminal
To open Visual Studio Code, enter the following command in the terminal:
code
If you installed the insider version, use:
code-insiders
Launch from the Graphical Interface
For a GUI-based approach, open the application menu on your Rocky Linux desktop. Search for “Visual Studio Code” or “VS Code” and click the icon to start the program.


Manage Visual Studio Code on Rocky Linux
After installing Visual Studio Code, managing updates and removal is essential to ensure your system remains efficient and secure. This section explains how to update Visual Studio Code to its latest version and how to uninstall it if needed.
How to Update Visual Studio Code on Rocky Linux
Regular updates are critical to maintaining the performance, security, and functionality of Visual Studio Code. Updates often include bug fixes, new features, and important security patches.
Updating Visual Studio Code Only
If you prefer to update only Visual Studio Code without updating all other system packages, you can use the following command. This is an optional step if you’ve already run the full system upgrade.
sudo dnf upgrade code
If you installed the insider version, update it using:
sudo dnf upgrade code-insiders
These commands ensure you are running the latest version of Visual Studio Code while avoiding unnecessary updates to other system components.
How to Remove Visual Studio Code on Rocky Linux
You might need to uninstall Visual Studio Code for several reasons, such as troubleshooting or switching to another editor. Follow the steps below to remove Visual Studio Code from your system.
Uninstalling the Stable Version
To remove the stable version of Visual Studio Code, run:
sudo dnf remove code
This command removes Visual Studio Code and its associated files from your system.
Uninstalling the Insider Version
If you are using the insider version, you can uninstall it with:
sudo dnf remove code-insiders
Cleaning Up the Repository
After uninstalling Visual Studio Code, you might consider removing the Microsoft repository if you do not plan to reinstall VS Code in the future. This is an optional step that helps keep your system’s repository list clean and reduces unnecessary checks during system updates. Use the following command to delete the repository file:
sudo rm /etc/yum.repos.d/vscode.repo
This step is optional but recommended if you do not plan to reinstall Visual Studio Code in the future. It helps keep your system clean and reduces the number of repositories the package manager checks during updates.
Conclusion
By following this guide, you’ve set up Visual Studio Code on Rocky Linux and unlocked a flexible, feature-rich development environment. To keep things running smoothly, remember to check for updates regularly and consult the official documentation or Rocky Linux community if you need help.
Have tips, questions, or customizations to share? Drop a comment below—your experience can help others in the community. And if you’re looking to get even more from your system, check out our other Linux guides and development tool tutorials.