1080*80 ad

How to Install VS Code on CentOS Stream 9: A Simple Guide

A Developer’s Guide to Installing VS Code on CentOS Stream 9

Visual Studio Code (VS Code) has become an indispensable tool for developers worldwide. This powerful, free, and open-source code editor from Microsoft offers a lightweight yet feature-rich environment with extensive support for debugging, embedded Git control, syntax highlighting, and intelligent code completion.

If you’re running CentOS Stream 9 and want to supercharge your development workflow, installing VS Code is one of the best moves you can make. This guide provides a straightforward, step-by-step process to get VS Code running on your system.

Prerequisites

Before we begin, ensure you have the following:

  • A system running CentOS Stream 9.
  • Access to a user account with sudo or root privileges.
  • A stable internet connection to download the necessary files.

As a best practice, it’s always a good idea to update your system’s packages first. Open your terminal and run:

sudo dnf update -y

Step-by-Step Installation Guide

We will install VS Code by adding the official Microsoft repository to our system. This method ensures you receive automatic updates through the standard dnf update process, keeping your editor secure and up-to-date.

Step 1: Import the Microsoft GPG Key

First, you need to import the Microsoft GPG (GNU Privacy Guard) key. This is a critical security step that verifies the authenticity of the software packages you are about to install. It confirms that the code comes directly from Microsoft and has not been altered.

Execute the following command in your terminal:

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

Step 2: Add the Visual Studio Code Repository

Next, you must add the official VS Code repository to your system’s repository list. This tells the dnf package manager where to find and download the software.

Run the command below to create a new repository file:

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'

This command creates the /etc/yum.repos.d/vscode.repo file and populates it with the necessary configuration to access the VS Code packages.

Step 3: Install Visual Studio Code

With the repository added and the GPG key imported, you are now ready to install VS Code. The process is as simple as running a single command. The dnf package manager will automatically handle all dependencies.

sudo dnf install code

The system will check the repository, find the code package, and ask for your confirmation to proceed with the installation. Type y and press Enter to continue.

Once the installation is complete, you have successfully installed Visual Studio Code on your CentOS Stream 9 machine.

How to Launch VS Code

You can launch your new code editor in two convenient ways:

  1. From the Desktop Environment: Click on “Activities” in the top-left corner of your screen, type “Visual Studio Code” into the search bar, and click the application icon to open it.

  2. From the Terminal: For quicker access, simply open a new terminal window and type the following command:

    code
    

You can also open a specific project folder directly from the terminal by navigating to its directory and running code ..

Next Steps: Enhance Your Experience

You now have a powerful development environment at your fingertips. To get the most out of VS Code, consider exploring the Extensions Marketplace. You can find extensions for nearly any language or framework, including:

  • Python: Microsoft’s official Python extension for linting, debugging, and IntelliSense.
  • Docker: For managing and building containers directly within the editor.
  • Prettier – Code formatter: To keep your code clean and consistently formatted.
  • GitLens: To supercharge the built-in Git capabilities and gain deeper insight into your code’s history.

Conclusion

You have successfully installed Visual Studio Code on CentOS Stream 9. By following the repository method, you have not only set up a powerful code editor but also ensured that it will be seamlessly updated and maintained alongside your other system packages. This robust setup provides a stable and efficient foundation for all your future development projects.

Source: https://infotechys.com/install-vs-code-on-centos-stream-9/

900*80 ad

      1080*80 ad