December 3, 2021
How to install nodejs 14 and npm on Rockly linux 8:

How To Install Node.js 14 and npm on Rocky Linux 8

On this article we will learn how to install Node.js 14 and its package manager (NPM) 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 Installation on Rocky Linux 8

The installation will be consist of several stage, 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

1. Updating Rocky Linux 8 system

Before starting installation, we are advised to update our system first. By updating our system, it will refresh the local list of available software packages. To update system repositories, we will use the command line : sudo dnf update.

[ramansah@otodiginet ~]$ sudo dnf update
[sudo] password for ramansah: 
Rocky Linux 8 - AppStream                                                     452  B/s | 4.8 kB     00:10    
Rocky Linux 8 - AppStream                                                      17 kB/s | 8.7 MB     08:41    
Rocky Linux 8 - BaseOS                                                        6.8 kB/s | 4.3 kB     00:00    
Rocky Linux 8 - BaseOS                                                        1.4 MB/s | 5.6 MB     00:03    
Rocky Linux 8 - Extras                                                        2.7 kB/s | 3.5 kB     00:01    
Rocky Linux 8 - Extras                                                        4.7 kB/s | 4.3 kB     00:00    
Dependencies resolved.
==============================================================================================================
 Package                                     Arch   Version                                   Repo       Size
==============================================================================================================
Installing:
 kernel                                      x86_64 4.18.0-305.12.1.el8_4                     baseos    5.9 M
 kernel-core                                 x86_64 4.18.0-305.12.1.el8_4                     baseos     36 M
 kernel-modules                              x86_64 4.18.0-305.12.1.el8_4                     baseos     28 M
Upgrading:
 NetworkManager                              x86_64 1:1.30.0-10.el8_4                         baseos    2.6 M
 NetworkManager-adsl                         x86_64 1:1.30.0-10.el8_4                         baseos    140 k

2. Checking the Node.js Versions Availability

We believe if we had the last stable packages on the system, after updating the system. For install the last stable Node.js from Rocky Linux repository we have to verifty the version available on our system. For doing this, we will submit the command line : dnf module list nodejs.

[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
Node.js 14 list on Rocky Linux 8
Node.js 14 list on Rocky Linux 8

3. Seting Node.js version to install

On this stage, we will define what Node.js to be installed on our system. As shown above, there are three version on Node.js available on our system. Then we select the last version of Node.JS (version 14) by submitting command line : sudo dnf module enable nodejs:14.

[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
Complete!
Node.js 14 version enablement
Node.js 14 version enablement

Then we verify by submitting the command line dnf module list nodejs again.

[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          

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
Node.js 14 version selection
Node.js 14 version selection

4. Install Node.js & NPM on Rocky Linux

On this stage, we will insall Node.js version 14. We will submit the command line : sudo dnf install nodejs.

[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.
...
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                                                
Node.js 14 installation on Rocky Linux 8
Node.js 14 installation on Rocky Linux 8

5. Checking Node.js Version

The Node.js and NPM has been installed successfully, then we will verify it by querying its version. We will submit the command line : node --version and npm --version.

[ramansah@otodiginet ~]$ node --version
v14.17.3
[ramansah@otodiginet ~]$ npm --version
6.14.13
Node.js and npm version
Node.js and npm version

Conclusion

So far, we have shown you how to install Node.js 14 on Rocky Linux 8. Have a nice day.

Share this article via :

Leave a Reply

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