How to install Node.js 12 LTS on CentOS 7 and Fedora 31/30/29

Welcome to our guide on how to install Node.js 12 LTS on CentOS 7 and Fedora 31/3029 Linux systems. Node.js 12 entered the active LTS state on 2019-10-21 and is expected to continue until 2022-04-30. Node.js is a powerful open source JavaScript runtime built on Chrome’s V8 JavaScript engine for building fast and scalable web applications.

Here are the steps to install Node.js 12 LTS on CentOS 7/8 and Fedora 31/30/29 Linux computers. You need to have root user access or log in to the server as a user with sudo privileges.

For Ubuntu / Debian, use: How to install Node.js 12 on Ubuntu / Debian / Linux Mint

Step 1: Update the system

Update your CentOS / Fedora system:

---- Fedora ----
$ sudo dnf -y update

--- CentOS 7 ------
$ sudo yum -y update

Step 2: Install Node.js 12 LTS on CentOS 7 and Fedora 31/30/29

To install Node.js 12.x LTS on CentOS 7 and Fedora 31/30/29, use the NodeSource binary distribution.

curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -

The above command will install the NodeSource Node.js 12.x repository. After adding the repository, install Node.js 12 LTS.

On CentOS 7:

sudo yum clean all && sudo yum makecache fastsudo yum install -y gcc-c++ makesudo yum install -y nodejs

On Fedora 31/30/29:

sudo dnf install -y gcc-c++ makesudo dnf install -y nodejs

Confirm the node version:

$ node -v
v12.13.0

You have installed Node.js 12 LTS on CentOS 7 and Fedora 31/30/29 Linux systems.

Sidebar