Installing node 6x or 5x or 4x 9.4 to unbuntu server.
This guide assumes that you are using Ubuntu 16.04. Before you begin, you should have a non-root user account with
sudo privileges set up on your system.
Please follow following steps to install node.js on server.
- Step 1.
$sudo apt-get update
- Step 2 Choose required version of node.js to be installed.
# for Node.js v4 $curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - # OR for Node.js v5 $curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash - # OR for Node.js v6 $curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - # OR for Node.js v7 $curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
- Step 4 Install node.js
$sudo apt-get install -y nodejs
- Step 5 : Link nodejs command to node command. This is important step. By default node.js installed via node.js command.
$sudo ln -s /opt/node/bin/node /usr/local/bin/node $sudo ln -s /opt/node/bin/npm /usr/local/bin/npm
- Step 6: The
nodejspackage contains the
nodejsbinary as well as
npm, so you don’t need to install
npmseparately. However, in order for some
npmpackages to work (such as those that require compiling code from source), you will need to install the
$sudo apt-get install -y build-essential
You can check your installation via node -v command. This will return you version of node.js you just installed.
Latest posts by Shankar Morwal (see all)
- Upgrade node.js version in ubuntu 14 or ubuntu 16 - May 8, 2017
- Angular 4 will be out soon, Everything you need to know - February 20, 2017
- Installing teamcity 10.0.4 on ubuntu server - January 17, 2017