On CentOS/RHEL,
curl --silent --location https://rpm.nodesource.com/setup_4.x | bash - yum install nodejs gcc-c++ make npm install mongodb
Ref. https://nodejs.org/en/download/package-manager/
Eventually check that node is working fine,
cd ~/ mkdir nodejs/ cd nodejs/ vi hello.js
var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/html"}); response.end("Hello World!\n"); }).listen(8080);
node hello.js curl 127.0.0.1:8080