Welcome to our guide on how to install Node.js 12,10 LTS on CentOS 8 / RHEL 8 Linux system. Node.js is a popular free and open-source server-side programming language which runs on various platforms (Linux, Windows, Unix, macOS).
You can also learn about RHEL 8 new features from my previous article Red Hat Enterprise Linux 8 (RHEL 8) New Features & Review.
Installing Node.js 12,10 LTS on RHEL 8 / CentOS 8
Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine for easily building fast, scalable network applications. To install Node.js 12,10.x LTS on RHEL 8 / CentOS, use the AppStream repository. RHEL 8 distributes Node.js 16,14,12, and 10 as of this article update.
See available Node versions on:
$ dnf module list nodejs
Last metadata expiration check: 0:03:49 ago on Mon 21 Aug 2023 09:16:06 AM UTC.
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
nodejs 18 common [d], development, minimal, s2i Javascript runtime
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
The default version installed is Nodejs 10 but you can explicitly specify the version of Node.js to install.
### Node.js 12 ###
sudo dnf module install nodejs:12
### Node.js 10 ###
sudo dnf module install nodejs:10
When prompted for a y/n confirmation, press y.
Transaction Summary
=======================================================================================================================================================
Install 3 Packages
Total download size: 12 M
Installed size: 56 M
Is this ok [y/N]: y
Wait for the installation to finish then check the version:
$ node --version
v12.22.12
If you’re interested in installing Node.js v16 and v18 instead, install it like below
sudo dnf module install nodejs:18
sudo dnf module install nodejs:16
Full package details can be viewed using the rpm
command.
$ rpm -qi nodejs
Name : nodejs
Epoch : 1
Version : 12.22.5
Release : 1.module+el8.4.0+647+e905fa21
Architecture: x86_64
Install Date: Thu May 5 23:30:20 2022
Group : Development/Languages
Size : 38168683
License : MIT and ASL 2.0 and ISC and BSD
Signature : RSA/SHA256, Tue Sep 21 21:23:59 2021, Key ID 15af5dac6d745a60
Source RPM : nodejs-12.22.5-1.module+el8.4.0+647+e905fa21.src.rpm
Build Date : Tue Sep 21 21:16:37 2021
Build Host : ord1-prod-x86build002.svc.aws.rockylinux.org
Relocations : (not relocatable)
Packager : [email protected]
Vendor : Rocky
URL : http://nodejs.org/
Summary : JavaScript runtime
....
You may also need to install Development Tools for building Node software.
sudo dnf install -y gcc-c++ make
You now have Node.js 12 / Node.js 10 installed on your RHEl 8 server. Also read