How To Install Node.js on Rocky Linux 8

In this guide, we want to teach you How To Install Node.js on Rocky Linux 8.

Node.js (Node) is an open-source development platform for executing JavaScript code server-side. Node is useful for developing applications that require a persistent connection from the browser to the server and is often used for real-time applications such as chat, news feeds, and web push notifications.

Node.js is intended to run on a dedicated HTTP server and to employ a single thread with one process at a time. Node.js applications are event-based and run asynchronously. Code built on the Node platform does not follow the traditional model of receive, process, send, wait, and receive. Instead, Node processes incoming requests in a constant event stack and sends small requests one after the other without waiting for responses.

How To Install Node.js on Rocky Linux 8

Before you start to install Node.js, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article the Initial Server Setup with Rocky Linux 8.

Now you can follow the steps below to complete this guide.

Set up Node.js and NPM on Rocky Linux 8

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

sudo dnf update -y

To install the latest release of Node.js, you don’t need to add any repository manually to get the packages for the installation of this Java programing language and its package manager.

CentOS and RHEL 8 along with other RPM Linux already have a dedicated module for it.

At this point, you can see what versions of Node.js are available on Rocky Linux 8 with the command below:

sudo dnf module list nodejs
Rocky Linux 8 - AppStream
Name Stream Profiles Summary
nodejs 10 [d] common [d], development, minimal, s2i Javascript runtime
nodejs 12 common [d], development, minimal, s2i Javascript runtime
nodejs 14 common [d], development, minimal, s2i Javascript runtime
nodejs 16 common [d], development, minimal, s2i Javascript runtime

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

As you can see, the default version of Node.js is 10 and the latest version of it is 16.

To enable the latest LTS one that is 16 to install by default on the system, run the following command:

sudo dnf module enable nodejs:16

Then, you can use the command below to install Node.js on your server:

sudo dnf install nodejs


When your installation is completed, you can verify your Node.js installation on Rocky Linux 8 by checking its version:

node --version

Also, check the NPM version:

npm --version


At this point, you learn to Install Node.js on AlmaLinux 8.

Hope you enjoy it.

You may be interested in these articles on the orcacore website:

Set up SVN Server on Rocky Linux 8

How To Install Python 3.10 on Rocky Linux 8

How To Set up Ntopng on Rocky Linux 8

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!