I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 16.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install Node.js on Ubuntu 16.04
Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:
apt-get update -y apt-get upgrade -y apt-get install -y build-essential
Step 2. Installing Node.js.
If you just want to get Node.js installed on Ubuntu (specifically Xenial Xerus distributions), and don’t need anything else other than the quick how, here are the two commands you need to run:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
Run the following command to make sure that you install the latest version of Node.js:
apt-get install -y nodejs
Once this install is run to completion, should have been successfully installed on the system.
Step 3. Verify Node.js Installation.
Check the version of Node.js using the following command:
$ nodejs -v v6.5.0 $ npm -v 3.10.3
Congratulation’s! You have successfully configured Node.js on your Ubuntu 16.04 LTS server.