How to Install NodeJS on AlmaLinux 8

NodeJS is a JavaScript runtime environment and it is primarily used for non-blocking, event-driven servers, due to its single-threaded nature. It's used for traditional websites and back-end API services but was designed with real-time, push-based architectures. It offers users the ability to write websites in JavaScript whose code executes on the server instead of a client's browser.

First, check for the update to keep the server up to date.

yum update -y

Installing NodeJS

To list the available NodeJS streams.

yum module list nodejs

Output:

[[email protected] ~]# yum module list nodejs
Last metadata expiration check: 0:00:16 ago on Fri 19 Feb 2021 01:48:04 AM EST.
AlmaLinux 8.3 - 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

Extra Packages for Enterprise Linux Modular 8 - x86_64
Name      Stream    Profiles                                Summary
nodejs    13        default, development, minimal           Javascript runtime

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

Command to Install NodeJS.

yum module install nodejs:14

Output:

[[email protected] ~]# yum module install nodejs:14
Last metadata expiration check: 0:00:43 ago on Fri 19 Feb 2021 01:48:04 AM EST.
Dependencies resolved.
================================================================================
 Package      Arch   Version                                    Repo       Size
================================================================================
Installing group/module packages:
 nodejs       x86_64 1:14.15.0-1.module_el8.3.0+2022+0cf59502   appstream  11 M
 npm          x86_64 1:6.14.8-1.14.15.0.1.module_el8.3.0+2022+0cf59502
                                                                appstream 3.8 M
Installing weak dependencies:
 nodejs-docs  noarch 1:14.15.0-1.module_el8.3.0+2022+0cf59502   appstream 8.0 M
 nodejs-full-i18n
              x86_64 1:14.15.0-1.module_el8.3.0+2022+0cf59502   appstream 7.5 M
Installing module profiles:
 nodejs/common

Enabling module streams:
 nodejs              14
.
.
.
.
.
Installed:
  nodejs-1:14.15.0-1.module_el8.3.0+2022+0cf59502.x86_64
  nodejs-docs-1:14.15.0-1.module_el8.3.0+2022+0cf59502.noarch
  nodejs-full-i18n-1:14.15.0-1.module_el8.3.0+2022+0cf59502.x86_64
  npm-1:6.14.8-1.14.15.0.1.module_el8.3.0+2022+0cf59502.x86_64

Complete!

Command to verify,

node -v 

Output:

[[email protected] ~]# node -v
v14.15.0

This Concludes how you install NodeJS on AlmaLinux 8. Now you can begin using it to host your website, along with using npm to install any necessary JavaScript packages.

If you can not configure and face any technical difficulties, kindly reach out to us via Support Ticket.