How to Install Visual Studio Code on AlmaLinux EL9 or EL8

Visual Studio Code (VSCode) stands out as a versatile and powerful code editor, catering to a wide array of programming needs. In this guide, we will navigate the steps to install Visual Studio Code on AlmaLinux 9 or its older stable enterprise-based release AlmaLinux 8, ensuring you have access to a top-tier development environment.

Key Features of Visual Studio Code:

  • Cross-Platform Compatibility: Available on Windows, macOS, and Linux, VSCode ensures a consistent coding experience across different operating systems.
  • Extensive Extension Marketplace: Enhance VSCode’s functionality with a plethora of extensions, supporting various programming languages, debuggers, and tools.
  • Customizable Workspace: Tailor your development environment with personalized themes, keyboard shortcuts, and editor settings.
  • Integrated Terminal: Execute commands and scripts directly within the editor, streamlining your development workflow.
  • Git Integration: Efficiently manage your repositories with built-in Git support, handling tasks like staging changes and resolving conflicts in the editor.
  • Comprehensive Language Support: Benefit from IntelliSense, code completion, and refactoring for a wide range of programming languages, thanks to the Language Server Protocol.
  • Real-Time Collaboration: Share coding sessions and collaborate in real-time with peers, regardless of the operating system, using the Live Share extension.

Embracing VSCode on AlmaLinux enhances your development experience, providing a rich set of features and customization options to tackle coding projects of any size efficiently. The upcoming guide will detail the installation process of Visual Studio Code on AlmaLinux 9 or 8, setting you on the path to a more productive and streamlined coding environment.

Install Visual Studio Code on AlmaLinux via RPM

Step 1: Update AlmaLinux Before Visual Studio Code Installation

To ensure a smooth installation process and optimal system performance, it is essential to update your AlmaLinux system. Open your terminal and run the following command to bring your system up to date:

sudo dnf upgrade --refresh

This command refreshes the package database and upgrades the installed packages to their latest versions.

Step 2: Import Visual Studio Code RPM on AlmaLinux

By default, Visual Studio Code is unavailable in the standard AlmaLinux repositories. However, you can add the official Visual Studio Code repository to your system with the following steps:

Import VSCode GPG Key on AlmaLinux:

Firstly, import the GPG key to verify the authenticity of the packages you are about to install:

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

Import VSCode RPM Repository on AlmaLinux:

Next, add the Visual Studio Code repository to your system with 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 new repository file and configures it to access the Visual Studio Code packages. You should see the repository details printed in your terminal, confirming the successful addition.

With the repository now configured, you are ready to install Visual Studio Code on AlmaLinux.

Step 3: Install Visual Studio Code on AlmaLinux

Visual Studio Code offers two builds: the stable build and the insider build. The stable build is recommended for most users due to its tested and stable nature.

Option 1: Install VSCode Stable Build (Recommended)

To install the stable build of Visual Studio Code, run the following:

sudo dnf install code

Option 2: Install VSCode Insiders Build (Upstream)

If you wish to access the latest features and updates, opt for the insider build. Install it using:

sudo dnf install code-insiders

During the initial installation of Visual Studio Code, you should notice the GPG key being imported, ensuring the integrity and authenticity of the package.

Importing GPG key 0xBE1229CF:
 Userid     : "Microsoft (Release signing) <gpgsecurity@microsoft.com>"
 Fingerprint: BC52 8686 B50D 79E3 39D3 721C EB3E 94AD BE12 29CF
 From       : https://packages.microsoft.com/keys/microsoft.asc

Install Visual Studio Code on AlmaLinux via Flatpak and Flathub

Step 1: Enable Flathub for Visual Studio Code on AlmaLinux

To begin, verify the presence of the Flathub repository in your system’s Flatpak configuration. Flathub hosts a variety of applications, including Visual Studio Code. If you haven’t added it yet, execute the command below to integrate the Flathub repository with Flatpak:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

This command ensures that Flathub is part of your Flatpak configuration, paving the way for software installations from this repository.

Step 2: Install Visual Studio Code on AlmaLinux via Flatpak Command

Now that you have Flathub configured proceed to install Visual Studio Code. Run the following command to initiate the installation:

flatpak install flathub com.visualstudio.code

This command searches for Visual Studio Code within the Flathub repository and installs it onto your AlmaLinux system.

Troubleshooting Flathub Activation on AlmaLinux

Occasionally, Flathub might not activate as anticipated, even after adding it to your system. If this occurs, execute the following command to resolve the issue and enable Flathub:

flatpak remote-modify --enable flathub

Launch Visual Studio Code (VSCode) on AlmaLinux

CLI Methods to Launch VSCode on AlmaLinux

Visual Studio Code is now ready for use, and you can open it through various methods. For command-line enthusiasts, Visual Studio Code offers a swift launch experience. To open the stable build, enter:

code

For the insider build, which provides access to the latest features, use:

code-insiders

If you have installed Visual Studio Code via Flatpak, utilize the following command:

flatpak run com.visualstudio.code

GUI Method to Launch VSCode on AlmaLinux

Desktop users can also open Visual Studio Code without delving into the command line. Follow these steps for a graphical launch:

  1. Click the ‘Activities’ button at the top-left corner of the screen.
  2. Select ‘Show Applications’, identifiable by a grid icon, to view all installed applications.
  3. Locate and click the Visual Studio Code icon to initiate the application.
Display of Visual Studio Code Stable and Insider Build icons in the applications menu on AlmaLinux.Pin
Compare the Visual Studio Code Stable and Insider Build icons as they appear in the AlmaLinux applications menu.

Tips for Getting Started with Visual Studio Code on AlmaLinux

Visual Studio Code (VSCode) stands out as a versatile and powerful code editor, tailored to meet the needs of developers working on diverse projects. As you begin your experience with VSCode on AlmaLinux, consider these tips to optimize your workflow and enhance your coding efficiency.

General VSCode Tips for First-Time Users with AlmaLinux

  • Familiarize Yourself with the Interface: Spend some time exploring the VSCode interface. Identify where the Explorer, Source Control, and Extensions views are located, as these are crucial for your daily tasks.
  • Learn Keyboard Shortcuts: Keyboard shortcuts can significantly speed up your workflow. Use Ctrl + Shift + P to open the Command Palette, a central place for commands. You can find a list of shortcuts in the Help menu.
  • Utilize the Integrated Terminal: VSCode comes with an integrated terminal. Access it with `Ctrl + “ to run commands directly within the editor, streamlining your workflow.

VSCode Customizations to Enhance Your Experience with AlmaLinux

  • Install Extensions: Enhance VSCode’s functionality by installing extensions. Navigate to the Extensions view (Ctrl + Shift + X), and search for extensions that suit your programming language or workflow.
  • Personalize Your Theme: Make your workspace your own by changing the color theme. Go to File > Preferences > Color Theme and select a theme that is visually pleasing to you.
  • Configure Your Settings: Tailor VSCode to your preferences by adjusting settings. Access settings through File > Preferences > Settings or by pressing Ctrl + ,.
{
  "editor.fontSize": 16,
  "editor.lineHeight": 25,
  "files.autoSave": "onFocusChange"
}

Other VSCode Handy Tips with AlmaLinux

  • Use the Breadcrumbs Feature: Breadcrumbs at the top of the editor make it easy to navigate through your code, showing the current file’s location in the directory structure.
  • Leverage the Power of Extensions: Extensions like ESLint for JavaScript or Python for Python development can significantly enhance your coding experience, providing linting and intelligent code completion.
  • Explore the Marketplace: The VSCode Marketplace is a treasure trove of extensions and themes. Take time to explore and find tools that can enhance your productivity.

By incorporating these tips into your daily use of Visual Studio Code on AlmaLinux, you set the stage for a more efficient, personalized, and enjoyable coding experience.

Visual Studio Code interface opened and ready for use on an AlmaLinux desktop.Pin
A glimpse into the user interface of Visual Studio Code running on an AlmaLinux desktop.

Managing Visual Studio Code on AlmaLinux

Updating Visual Studio Code

Maintaining the latest version of Visual Studio Code ensures optimal performance and security. Execute the following command to update all DNF packages, including Visual Studio Code:

sudo dnf update --refresh

For Flatpak installations, the following command checks and updates all installed Flatpak applications:

flatpak update

Uninstalling Visual Studio Code

To remove Visual Studio Code from your AlmaLinux system, use the appropriate command based on your installation method. For DNF installations:

sudo dnf remove code

Or, for the insider build:

sudo dnf remove code-insiders

To completely remove Visual Studio Code and its repository, ensuring no future installations from this source, run:

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

Flatpak Removal Method for Visual Studio Code

For those who have installed Visual Studio Code via Flatpak, the following command will uninstall it:

flatpak uninstall com.visualstudio.code

Conclusion

In conclusion, installing Visual Studio Code on AlmaLinux offers a streamlined and efficient development environment tailored to your needs. Whether you choose the RPM, Flatpak, or any other installation method, you can access a robust set of features that enhance your coding experience. By following the detailed steps, you ensure a smooth setup, allowing you to dive straight into your projects with the latest tools at your fingertips. Remember to keep your installation updated and tailor the settings to suit your workflow, ensuring a seamless and productive development journey on your AlmaLinux system.

Leave a Comment


Your Mastodon Instance
Share to...