Installing using Package Manager
Execute the following commands to install the latest Node in ubuntu
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install nodejs
Installing Using Pre-Built Binary Package in Custom Location
- Download the Latest version of Node from here.
Put the tarball file in the desired location, where you want to put the binary file.
Update the system path to have the binary of Node.
According to the desired location we can change global package installation by executing the following commands:
npm config list #This gives us information about our install
npm config get prefix # give information about current global installation location.
npm config set prefix=</path-to-download-the-packages>
You may have to put the path of nodejs to the system path.