How to Install Latest Node.js and NPM on Ubuntu with PPA

Node.js is an open-source, cross-platform for general-purpose programming and built on Chrome’s JavaScript run-time environment that easily executes JavaScript code outside of a browser and
easily building fast, scalable network applications.The latest version of node.js ppa is maintaining by its own official website.In this blog post tutorial we are going to show you step by step instructions to add this PPA to your Ubuntu 19.10, 18.04 LTS, 16.04 LTS (Trusty Tahr) and 14.04 LTS (Xenial Xerus) systems
and install Latest Nodejs to on Linux VPS with the simple commands

Step 1 – Add Node.js PPA

As per requirements this is depending upon your choice to select which version to install in your system and Before installing the latest version of Node.js in your system, you must add its PPA to Ubuntu.Node.js package is available in the LTS release and the current release. Let’s add the PPA to your system to install Nodejs on Ubuntu.

Use below Command For Current Release:

$ sudo apt-get install curl
$ curl -sL | sudo -E bash -

Use below Command for LTS Release

$ sudo apt-get install curl
$ curl -sL | sudo -E bash -

Note :- In this tutorial, I am going to use the latest current release of nodejs and add their PPA to my system.


Step 2 – Install Node.js on Ubuntu System

Now we can successfully add Node.js PPA to the Ubuntu system and will execute the below command to install Nodejs on Ubuntu system using apt-get. This command will be also going to install NPM with node.js as well as many other dependent packages on Ubuntu System.

$ sudo apt-get install nodejs



Step 3 – Check Version of Node.js and NPM

After installation of node.js we will check and verify the installed version of node.js.
We can use the below commands to view the installed node.js & npm version number.

$ node -v 


& also checking npm version

$ npm -v 



Step 4 – Create Demo on Web Server

If you want to check and verify your node.js installed. Let’s create a web server with “Hello World” text.
Creating a file with name test_server.js like below:-

# vim test_server.js

After creating a file adding the some following content

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

After that we should save the file and run below commands to start the server.

node  test_server.js

You should see an output that reads:

debugger listening on port 5858
Server running at

You can also start the application with debugging through below commands.

$ node --inspect server.js

Debugger listening on ws://
For help, see:
Server running at


Now we can open the browser and type server hostname or IP address followed by port number 3000 like below:-


then we will see a default page with Hello World.



Leave a Reply

Your email address will not be published. Required fields are marked *