How to install Node.JS on Rocky Linux 8
How to install Node.JS on Rocky Linux 8

How To Install Node.Js On Rocky Linux 8

On this short article we will install Node.js on Rocky Linux 8 operating system.

Introduction

Node.js is an open-source, cross-platform, back-end JavaScript runtime environment for server-side programming. On this article, we will discuss how to install Node.js on Rocky Linux 8. Node.Js enables executing JavaScript code outside a web browser. Node.js allows developers to create scalable backend functionality using JavaScript and producing dynamic web page content before the page is sent to the user’s web browser. Node.js is using Google’s V8 JavaScript engine to interpret JavaScript which was developed by Ryan Dahl in 2009. NPM (Node Package Manager) is the default package manager for Node.js which helps developers share and reuse their code.

Node.js is a framework based on the fastest JavaScript compiler currently available, Google V8. The focus is on high efficiency since asynchronous I/O, i.e. the connection of external resources such as the network or the file system. Since Node.js is based on JavaScript, the entry barrier is correspondingly low, at least for web developers. Node.js is an extremely interesting technology that allows you to develop complex and very scalable web applications with just a few lines of code.

Install Nodejs and npm on Rocky Linux 8

The NodeJs installation will be consist of several steps as described below:

  1. Updating Rocky Linux 8 system
  2. Checking the Node.js versions availabality
  3. Seting Node.js version to install
  4. Install Node.js & NPM on Rocky Linux
  5. Checking Node.js Version

Updating Rocky Linux 8

Before installing new packages/software we are recommended to update our local repository to get the news packages list. For this purpose we will submit the following command lines :

$ sudo dnf update

Checking the Node.js versions availability

On this stage, we will check the Node.Js version which is available on our system.  To perform this task, we will submit the following command line :

$ dnf module list nodejs

Output :

[ramansah@otodiginet ~]$ dnf module list nodejs
Rocky Linux 8 - AppStream 2.6 MB/s | 8.7 MB 00:03 
Rocky Linux 8 - BaseOS 2.2 MB/s | 5.6 MB 00:02 
Rocky Linux 8 - Extras 7.9 kB/s | 4.3 kB 00:00 
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

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

Setting Node.js version to install

On this tutorial, we will chose Node.js version 14 to be installed on our system. To perform this task, we will submit the command line :

$ sudo dnf module enable nodejs:14

The output :

[ramansah@otodiginet ~]$ sudo dnf module enable nodejs:14
[sudo] password for ramansah:
Last metadata expiration check: 0:10:39 ago on Sat 21 Aug 2021 08:25:55 AM WIB.
Dependencies resolved.
==============================================================================================================
Package Architecture Version Repository Size
==============================================================================================================
Enabling module streams:
nodejs 14

Transaction Summary
==============================================================================================================

Is this ok [y/N]: y

After enabling version of Node.js, then we will verify it before go for installing. Again submit the following command line :

$ dnf module list nodejs

Then we will get the bracket [e] is marked on nodejs 14.

[ramansah@otodiginet ~]$ dnf module list nodejs
Last metadata expiration check: 0:02:02 ago on Sat 21 Aug 2021 08:35:27 AM WIB.
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 [e] common [d], development, minimal, s2i Javascript runtime

Install Node.js & NPM on Rocky Linux

At this time, we are ready to install Node.js, to perform the installation just hit the command line :

$ sudo dnf install nodejs

The output :

[ramansah@otodiginet ~]$ sudo dnf install nodejs
Last metadata expiration check: 0:12:28 ago on Sat 21 Aug 2021 08:25:55 AM WIB.
Dependencies resolved.
==============================================================================================================
Package Arch Version Repository Size
==============================================================================================================
Installing:
nodejs x86_64 1:14.17.3-2.module+el8.4.0+639+18660d0d appstream 11 M
Installing weak dependencies:
nodejs-docs noarch 1:14.17.3-2.module+el8.4.0+639+18660d0d appstream 8.1 M
nodejs-full-i18n x86_64 1:14.17.3-2.module+el8.4.0+639+18660d0d appstream 7.6 M
npm x86_64 1:6.14.13-1.14.17.3.2.module+el8.4.0+639+18660d0d appstream 3.7 M

Transaction Summary
==============================================================================================================
Install 4 Packages

Total download size: 30 M
Installed size: 141 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): nodejs-docs-14.17.3-2.module+el8.4.0+639+18660d0d.noarch.rpm 1.6 MB/s | 8.1 MB 00:04 
(2/4): nodejs-14.17.3-2.module+el8.4.0+639+18660d0d.x86_64.rpm 1.9 MB/s | 11 MB 00:05 
(3/4): npm-6.14.13-1.14.17.3.2.module+el8.4.0+639+18660d0d.x86_64.rpm 2.2 MB/s | 3.7 MB 00:01 
(4/4): nodejs-full-i18n-14.17.3-2.module+el8.4.0+639+18660d0d.x86_64.rpm 1.1 MB/s | 7.6 MB 00:07 
--------------------------------------------------------------------------------------------------------------
Total 4.0 MB/s | 30 MB 00:07 
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Running scriptlet: npm-1:6.14.13-1.14.17.3.2.module+el8.4.0+639+18660d0d.x86_64 1/1 
Preparing : 1/1 
Installing : nodejs-docs-1:14.17.3-2.module+el8.4.0+639+18660d0d.noarch 1/4 
Installing : nodejs-full-i18n-1:14.17.3-2.module+el8.4.0+639+18660d0d.x86_64 2/4 
Installing : npm-1:6.14.13-1.14.17.3.2.module+el8.4.0+639+18660d0d.x86_64 3/4 
Installing : nodejs-1:14.17.3-2.module+el8.4.0+639+18660d0d.x86_64 4/4 
Running scriptlet: nodejs-1:14.17.3-2.module+el8.4.0+639+18660d0d.x86_64 4/4 
Verifying : nodejs-1:14.17.3-2.module+el8.4.0+639+18660d0d.x86_64 1/4 
Verifying : nodejs-docs-1:14.17.3-2.module+el8.4.0+639+18660d0d.noarch 2/4 
Verifying : nodejs-full-i18n-1:14.17.3-2.module+el8.4.0+639+18660d0d.x86_64 3/4 
Verifying : npm-1:6.14.13-1.14.17.3.2.module+el8.4.0+639+18660d0d.x86_64 4/4 
Installed products updated.

Installed:
nodejs-1:14.17.3-2.module+el8.4.0+639+18660d0d.x86_64 
nodejs-docs-1:14.17.3-2.module+el8.4.0+639+18660d0d.noarch 
nodejs-full-i18n-1:14.17.3-2.module+el8.4.0+639+18660d0d.x86_64 
npm-1:6.14.13-1.14.17.3.2.module+el8.4.0+639+18660d0d.x86_64

Complete!

The Node.js installation is completed done.

Verify Node.js Installation

To verify Node.js installation, we will query its version by submitting command line :

$ node --version
$ npm --version

The output :

[ramansah@otodiginet ~]$ node --version
v14.17.3
[ramansah@otodiginet ~]$ npm --version
6.14.13
(Visited 80 times, 1 visits today)

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *