Installing Node JS on Ubuntu 16.04 LTS

Add NodeJS PPA

sudo apt-get install python-software-properties
curl -sL | sudo -E bash -

2. Install nodejs

sudo apt-get install nodejs
Verify version
name@host:~$node -v
name@host:~$npm -v

Optional – To test installation

Create a file server.js with the following contents

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Test Server');
}).listen(3000, "");
console.log('Server running at');

Access localhost:3000 from the browser

About sandeep

Passionate about sharing information on "how to".
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.