Today in this tutorial we’ll be installing node.js and npm on centos based server eg, cwp, vestacp, cpanel, webmin etc. Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.

STEP 1 :

Run as root on RHEL, CentOS, CloudLinux or Fedora:

Install build tools, this tools are necessary for the nodejs installation:

yum install gcc-c++ make
OR
yum groupinstall 'Development Tools'

Now enable node.js yum repository :

Node.js v17.x

curl -fsSL https://rpm.nodesource.com/setup_17.x | bash -

Node.js v16.x

curl -fsSL https://rpm.nodesource.com/setup_16.x | bash -

Node.js v14.x

curl -fsSL https://rpm.nodesource.com/setup_14.x | bash -

STEP 2 :

Now we’re going to install node.js and NPM:

yum install nodejs -y

To check the version of npm and node.js run this commands :

[root@mysterydata ~]# npm -v

[root@mysterydata ~]# node -v

By Sandeep B.

I'm a system admin and php developer and currently working as System Admin In CWP Control panel, expertise in Linux and Windows administration RHEL certified admin.