How to Install Latest Node.js on Ubuntu with PPA
Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Latest version node.js ppa is maintaining by its official website. We can add this PPA to your Ubuntu 21.10, 20.04 LTS, 18.04 LTS, 16.04 LTS (Trusty Tahr) and 14.04 LTS (Xenial Xerus) systems and install node.js on Linux VPS with easy commands.
Step 1 – Add Node.js PPA
Node.js package is available in the LTS release and the current release. It’s your choice to select which version you want to install on the system as per your requirements. Let’s add the PPA to your system to install Nodejs on Ubuntu.
Use Current Release – During the last update of this tutorial, Node.js 16 is the current Node.js version available.
Use LTS Release – Instead of current release, its good idea to use stable version. During the last update of this tutorial, Node.js 14 is the latest LTS release available.
For this tutorial, I am using the latest current release and added their PPA to my system.
Step 2 – Install Node.js on Ubuntu
You can successfully add Node.js PPA to the Ubuntu system. Now execute the below command install Node on and Ubuntu using apt-get. This will also install NPM with node.js. This command also installs many other dependent packages on your system.
That’s it. This will install Node.js on your Ubuntu system.
Step 3 – Check Node.js and NPM Version
After installing node.js verify and check the installed version. You can find more details about current version on node.js official website.
Also, check the npm version
Step 4 – Create Demo Web Server (Optional)
This is an optional step. If you want to test your node.js install. Let’s create a web server with “Hello World!” text. Create a file server.js
and add the following content
server.js
Save the file and close. Then start the Node application using the following command.
You can also start the application with debugging enabled with the following commands.
The web server has been started on port 3000. Now access http://127.0.0.1:3000/ URL in browser. Now you will need to configure a front-end server for your app.
Conclusion
This tutorial helped you to install the Latest Node.js version on an Ubuntu system. Also provides you instructions to install the Latest stable Node.js version on Ubuntu.