#1 Adding NodeJs PPA
First you need to node.js ppa in our system provide by nodejs official website. We also need to install python-software-properties package if not installed already.
sudo apt-get install python-software-properties curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
#2 Installing Node.js and NPM
After adding required PPA file, lets install Nodejs package. NPM will also be installed with node.js. This command will also install many other dependent packages on your system.
sudo apt-get install nodejs
#3 Check Node.js & 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 version of npm.
And you’re done! That’s how you can install Nodejs on your server.