
How to Install VSCode on RHEL 10: A Step-by-Step Guide
Visual Studio Code (VSCode) has become the go-to code editor for countless developers, thanks to its powerful features, extensive extension library, and lightweight performance. If you’re running Red Hat Enterprise Linux (RHEL) 10, integrating this versatile tool into your workflow is a straightforward process.
This guide will walk you through the best methods for installing VSCode on your RHEL 10 workstation, ensuring you have a stable and up-to-date development environment.
Why Choose VSCode on RHEL 10?
Before diving into the installation, it’s worth noting why this combination is so effective. RHEL 10 provides a secure, stable, and enterprise-grade operating system, while VSCode offers a flexible and modern coding environment. Together, they create a powerful platform for professional development, system administration, and everything in between.
Key benefits of VSCode include:
- Intelligent Code Completion (IntelliSense)
- Built-in Git Integration
- Integrated Terminal
- Powerful Debugging Tools
- A Massive Ecosystem of Extensions
Prerequisites
To get started, you only need two things:
- A system running a fresh installation of RHEL 10.
- Access to a user account with
sudoor root privileges.
Method 1: Using the Official Microsoft Repository (Recommended)
This is the highly recommended method for most users. By adding Microsoft’s official repository to your system, you ensure that VSCode will receive automatic updates alongside your regular system updates via the dnf package manager. This keeps your editor secure and equipped with the latest features.
Step 1: Import the Microsoft GPG Key
First, you need to import the Microsoft GPG key. This key is used to cryptographically sign the software packages, allowing your system to verify their authenticity and ensure they haven’t been tampered with.
Open your terminal and run the following command:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
Step 2: Add the Visual Studio Code Repository
Next, create a repository file that tells dnf where to find the VSCode packages. This command creates the necessary file in the correct directory with the required configuration.
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'
Step 3: Install Visual Studio Code
With the repository configured, you can now install VSCode just like any other package. The dnf package manager will handle all dependencies for you.
sudo dnf check-update
sudo dnf install code
Once the installation is complete, VSCode is ready to use!
Method 2: Manual Installation with an RPM Package
If you prefer to manage the installation manually or are working in an offline environment, you can download the .rpm package directly.
Step 1: Download the RPM Package
Navigate to the official Visual Studio Code website and download the 64-bit .rpm file. Be sure to save it to a known location, such as your Downloads folder.
Step 2: Install the Package
Open your terminal and navigate to the directory where you downloaded the file. For example, if it’s in your Downloads folder:
cd ~/Downloads
Now, use the dnf command to install the local package. Using dnf is better than rpm -i because it will automatically resolve and install any required dependencies.
sudo dnf install ./<your-vscode-file-name>.rpm
(Replace <your-vscode-file-name>.rpm with the actual name of the downloaded file.)
The main drawback of this method is that VSCode will not be updated automatically. You will need to periodically download and install new versions yourself.
Method 3: Installing via Flatpak
For users who prefer containerized applications for improved security and dependency management, Flatpak is an excellent choice. This method installs VSCode in a sandboxed environment.
Step 1: Ensure Flatpak and Flathub are Ready
RHEL 10 typically comes with Flatpak installed. To be sure, and to add the essential Flathub repository (the main source for Flatpak apps), run these commands:
sudo dnf install flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
You may need to restart your system for the changes to take full effect.
Step 2: Install VSCode from Flathub
With Flatpak configured, installing VSCode is as simple as running a single command:
flatpak install flathub com.visualstudio.code
The primary benefit of using Flatpak is application sandboxing, which isolates the application from the rest of your system, enhancing security.
Launching Visual Studio Code
Regardless of the method you chose, you can now launch VSCode in two ways:
- From the GUI: Click on the “Activities” menu in the top-left corner, search for “Visual Studio Code,” and click the icon.
- From the Terminal: Simply open a new terminal window and type
code, then press Enter.
code
Security Best Practices for VSCode
Now that VSCode is installed, keep these security tips in mind:
- Trust Your Extensions: Only install extensions from reputable publishers. The extension marketplace provides a powerful way to enhance VSCode, but poorly written or malicious extensions can pose a security risk.
- Keep Your Editor Updated: If you used the repository method, run
sudo dnf updateregularly. If not, make sure you manually update VSCode to patch any security vulnerabilities. - Review Workspace Trust: VSCode’s “Workspace Trust” feature helps protect you from untrusted code. Be cautious when opening projects from unfamiliar sources and only grant full trust to projects you know are safe.
You now have a fully functional and powerful code editor running on your RHEL 10 system. Happy coding
Source: https://infotechys.com/install-vscode-on-rhel-10-workstation/


