Installing node 6x or 5x or 4x 9.4 to unbuntu server.

Introduction

Node.js is a JavaScript platform for general-purpose programming that allows users to build network applications quickly. By leveraging JavaScript on both the front-end and the back-end, development can be more consistent and be designed within the same system.

Prerequisites

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 nodejs package contains the nodejs binary as well as npm, so you don’t need to install npmseparately. However, in order for some npm packages to work (such as those that require compiling code from source), you will need to install the build-essential package:
$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.

The following two tabs change content below.
He is founder and CTO of Habilelabs.io. He senior software architect. He is guru of various Mobile and web technologies including Node.js, Angular.js, Meteor.js. He is founder member of habilelabs Pvt. Ltd.