How to install nodeJs on Ubuntu 16.04

Today i am going to share how to Install nodeJs on Ubuntu 16.04

1. Upgrade your System

First thing you need to do is to upgrade your system software to the latest version. You can do that by using the following command:

1
sudo apt-get update && sudo apt-get -y upgrade

The upgrade process could take from few seconds to few minutes depends on the software that needs to be upgraded and your internet speed. Once your system is up to date, you can proceed with the other steps of this tutorial.

2. Install Node.js

npm is bundled with Node.js, so to install npm you only need to install Node.js on your Ubuntu. To install Node.js 4.x LTS on Ubuntu 16.04, run the following commands:

1
2
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

Alternatively, to install Node.js 6.x on Ubuntu 16.04, which is the current version of Node.js, run the commands below:

1
2
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

3. Verify npm Installation

To verify that the installation is successful you can check the version of npm:

 
1
npm -v

The output should be similar to the one below:

1
2
# npm -v
2.15.9