Install Visual Studio Code on Rocky Linux 8 with Easy Steps

Posted on

Install Visual Studio Code on Rocky Linux 8 with Easy Steps

This guide intends to teach you to Install Visual Studio Code on Rocky Linux 8. Visual Studio Code is “a free editor that helps the programmer write code, helps in debugging and corrects the code using the intelli-sense method”. In normal terms, it facilitates users to write the code easily. It’s a powerful and versatile code editor favored by developers worldwide.

It can be run on your desktop and the web and is available for Windows, macOS, Linux, and Raspberry Pi OS. Now follow the guide steps below on the Orcacore website to complete the VS Code setup on Rocky Linux 8.

To add the VS code repository and install it on Rocky Linux 8, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Rocky Linux 8.

1. Install VS Code on Rocky Linux 8

First, you need to update your local package index with the following command:

sudo dnf update -y

Then, install the development tools by using the command below:

sudo dnf groupinstall "Development Tools" -y

Visual studio code packages are not available in the default Rocky Linux repository. So you need to add it to your server.

Import Visual Studio Code GPG key

Here you need to import the GPG key to verify the authenticity of the packages to be installed. To do this, run the command below:

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

Add VS Code Repository

Now use the following command to import the repository on your server:

printf "[vscode]nname=packages.microsoft.comnbaseurl=https://packages.microsoft.com/yumrepos/vscode/nenabled=1ngpgcheck=1nrepo_gpgcheck=1ngpgkey=https://packages.microsoft.com/keys/microsoft.ascnmetadata_expire=1h" | sudo tee -a /etc/yum.repos.d/vscode.repo
VS Code repository Rocky Linux 8

When you are done, run the system update:

sudo dnf update -y

Now you can install Visual Studio code on Rocky Linux 8 by using the following command:

sudo dnf install code -y

2. How To Launch VS Code?

At this point, you can use different ways to open your VS code. You can easily launch your software, by using the following command:

code

Or, you can run the code & command, which you can continue to use the terminal during the application session:

code &

Also, you can open VSCode from your desktop. To do this, follow the following path:

**Applications -> Programming -> Visual Studio Code**

When you start VS Code for the first time, a window like the following will be displayed:

You can now begin installing extensions and configuring VS Code according to your preferences.

For more information, you can visit Visual Studio Code Documentation.

3. Update Visual Studio Code on Rocky Linux 8

When a new version of Visual Studio Code is released you can update the package through your desktop standard Software Update tool or by running the following commands:

# sudo dnf update -y
# sudo dnf upgrade -y

4. Remove VS Code From Rocky Linux 8

When you no longer want VSCode installed on your system, use the following command to remove it:

sudo dnf autoremove code -y

Next, remove the repository using the following command if you plan never to re-install the IDE again:

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

Conclusion

VS Code is used by programmers and developers for writing, editing, and managing code in various programming languages. At this point, you have learned to Install Visual Studio (VS) Code on Rocky Linux 8. This guide presented a straightforward method to Install Visual Studio Code on Rocky Linux 8.

Hope you enjoy it. You may also like these articles:

Install TensorFlow on Rocky Linux 8

Install Varnish Cache with Nginx on Rocky Linux 9

SFTP Server Setup Rocky Linux 8

PowerDNS Setup Rocky Linux 8

7-zip installation Rocky Linux 8

PHP ionCube Loader Rocky Linux 8

Portainer Docker Rocky Linux 8

Vagrant Rocky Linux 8

Alternative Solutions to Installing Visual Studio Code on Rocky Linux 8

While the above method using the official Microsoft repository is reliable, here are two alternative approaches to Install Visual Studio Code on Rocky Linux 8: using Flatpak and using Snap. These methods offer different ways to manage dependencies and updates.

1. Installing Visual Studio Code via Flatpak

Flatpak is a universal package manager for Linux that allows you to install applications in a sandboxed environment. This provides an extra layer of security and ensures that the application’s dependencies don’t conflict with your system’s packages.

Explanation:

Flatpak packages contain all the dependencies needed to run the application, making it self-contained. This means you don’t have to worry about version conflicts with system libraries. Flatpak also provides a consistent update mechanism, independent of the system’s package manager.

Steps:

  • Install Flatpak: If Flatpak is not already installed on your Rocky Linux 8 system, install it using the following command:

    sudo dnf install flatpak -y
  • Add the Flathub Repository: Flathub is the most popular repository for Flatpak applications. Add it using:

    sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
  • Install Visual Studio Code: Now, you can install Visual Studio Code using Flatpak:

    sudo flatpak install flathub com.visualstudio.code -y
  • Run Visual Studio Code: After the installation is complete, you can launch VS Code using:

    flatpak run com.visualstudio.code

    You can also find the VS Code icon in your application menu.

  • Updating VS Code (Flatpak):

    flatpak update

2. Installing Visual Studio Code via Snap

Snap is another universal package manager similar to Flatpak. It also provides a sandboxed environment for applications.

Explanation:

Snap packages, like Flatpak, bundle all dependencies. They also auto-update by default, ensuring you always have the latest version. However, Snap relies on a centralized Snap Store managed by Canonical (the company behind Ubuntu).

Steps:

  • Enable EPEL Repository: Snap packages are not available in the default Rocky Linux 8 repositories. You need to enable the EPEL (Extra Packages for Enterprise Linux) repository first:

    sudo dnf install epel-release -y
  • Install Snapd: Install the Snap daemon (snapd) using:

    sudo dnf install snapd -y
  • Enable Snapd Socket: Enable the snapd socket to allow snap communication:

    sudo systemctl enable --now snapd.socket
  • Create a Symbolic Link: Create a symbolic link for classic snap support:

    sudo ln -s /var/lib/snapd/snap /snap
  • Install Visual Studio Code: Install VS Code using the following command:

    sudo snap install code --classic
  • Run Visual Studio Code: Launch VS Code using:

    code

    You should also find it in your application menu.

  • Updating VS Code (Snap): Snaps typically update automatically. However, you can manually refresh them with:

    sudo snap refresh

These alternative methods offer flexibility in how you manage and Install Visual Studio Code on Rocky Linux 8. Flatpak is a good choice for a decentralized, open-source approach, while Snap offers automatic updates and a broader selection of applications (though it’s more centralized). Choose the method that best suits your needs and preferences. Regardless of the method you choose, getting VS Code up and running on Rocky Linux 8 will significantly enhance your development workflow.