In this guide, we want to teach you How To Install Node.js on Rocky Linux 8.
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
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
Output Installed: nodejs-1:16.13.1-3.module_el8.5.0+2605+45d748af.x86_64 nodejs-docs-1:16.13.1-3.module_el8.5.0+2605+45d748af.noarch nodejs-full-i18n-1:16.13.1-3.module_el8.5.0+2605+45d748af.x86_64 npm-1:8.1.2-126.96.36.199.3.module_el8.5.0+2605+45d748af.x86_64 Complete!
When your installation is completed, you can verify your Node.js installation on Rocky Linux 8 by checking its version:
Also, check the 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: