Steps to install Node.js on CentOS - Tech

  1. Portal Home
  2. Tech

Steps to install Node.js on CentOS

Node.js is a Chrome JavaScript runtime based platform for easily building fast, scalable web applications. The latest version of the node.js yum repository is maintained by its official website. Use this tutorial to add the yum repository and install the latest Nodejs on CentOS / RHEL 7/6 systems using simple commands.

Removing old nodejs versions.

yum remove nodejs

 

Step 1 - Add the Node.js Yum Repository
First, you need to enable the node.js yum repository on the system provided on the official Node.js website. You will also need to develop tools to build the native add-ons to be installed on the system.

Last posted.

yum clean all && yum makecache fast
yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_12.x | sudo -E bash -

Stable release.

yum clean all && yum makecache fast
yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_10.x | sudo -E bash -

Step 2 - Install Node.js on CentOS.
After adding the yum repository to your system, let's install the Node.js package. npm will also be installed along with node.js. This command will also install many other dependency packages on your system.

sudo yum install nodejs

Step 3 - Check Node.js and NPM versions
Verify and check the installed version after installing node.js. You can find more details about the current version on the official node.js website.

node -v 
 
// v12.3.1

Also, check the version of npm

npm -v
 
// 6.9.0

At this point, Node.js has been installed.