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

Microsoft Visual Studio Code is hugely popular with developers of all specialties, offering them a powerful and efficient source code editor. It provides extensive support, syntax highlighting and intelligently framed code completion, debugging capabilities and embedded Git control. It is open-source software with a free license, adding to its allure among web developers, system administrators, and data scientists. Its library of extensions also adds to its versatility; users can customize the coding experience by adding new programming languages, debuggers, and themes that match their unique needs.

In the following tutorial, you will learn how to install Visual Code Editor (VSCode) on Rocky Linux 9 or Rocky Linux 8 using the command line terminal and the official repository from Microsoft to ensure you always have the latest updated version with the command line terminal and bonus Visual Studio Code insiders and exploration installation commands included.

Update Rocky Linux – Upgrade System Packages

The first thing you must do before installing VSCode is to ensure your system packages are updated to the latest versions. To accomplish this task, open your Terminal window and run the following commands.

sudo dnf upgrade --refresh

Install Visual Studio Code (VSCode)

Visual Studio Code is not installed by default on Rocky Linux. You can quickly create and import the Visual Studio Code official repository on your system by following the steps.

Import the GPG key first before installing it.

sudo rpm --import

Import the repository by running the following commands.

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

You should see the following output in your terminal if the command is copied correctly.

Example only:

Now you can install VSCode. There are three options available, and I would suggest installing the stable build for most users, but you can alternatively install the insider’s build or the exploration build.

Install VSCode stable build (Recommended):

sudo dnf install code -y

Install VSCode insiders build:

sudo dnf install code-insiders -y

Install VSCode exploration build:

Please note that the exploration builds of Visual Code Studio are just one-time builds, and this demonstration is more for education purposes. Please install stable or insiders unless advised a unique build has been created in exploration.

sudo dnf install code-exploration -y

Note that you will be prompted to import GPG keys; select yes.

See also
How to Install AnyDesk on Rocky Linux EL9 or EL8


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

Ensure the above is correct.

How to Launch Visual Studio Code (VSCode)

Now that you have completed the installation, you can open the software in a few ways. First, using the command line terminal, you can open the software quickly by using the following command.


For desktop users who find the command line terminal a bit overwhelming and do not work with it often, you would open VSCode by navigating to its location.

Activities > Show Applications > Visual Studio Code


Jumpstart your Visual Studio Code experience by selecting a unique color theme! The prompt is conveniently located on the bottom left-hand side of the window. Once you choose a theme to match your style, it’s that simple – start coding.


Congratulations, you have installed Visual Studio Code on Rocky Linux.

Additional Commands & Tips

How to Update Visual Studio Code (VSCode)

Refresh your system with the latest updates by utilizing the “dnf upgrade –refresh” command across all DNF packages. This will keep your computer up-to-date quickly and easily, including any updates for VSCode if available.

sudo dnf upgrade --refresh

How to Remove (Uninstall) Visual Studio Code (VSCode)

To uninstall Visual Studio Code, run the following commands:

sudo dnf autoremove code -y

Remove the repository using this command if you intend not to reinstall the IDE again.

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

Comments and Conclusion

This quick how-to shows how to install the latest IDE version of VSCode on your Rocky Linux system. Overall, Visual Studio Code equips programmers with an invaluable aid in their work – a feature-rich source code editor that streamlines the coding process and enables quicker, more efficient development.

Leave a Comment

Share to...