How to install Node.js in a remote Ubuntu machine

As a system admin, I would like to do the following in some of my Ubuntu machines:-

  1. Find out if Node.js is installed for a certain user in a certain Ubuntu machine.
  2. Install a certain version
  3. Upgrade a certain version.

I would like to do this from a remote Ubuntu machine within my LAN. What software/tools should I use to do what I want?

For this class of problem I write scripts using Python Fabric http://docs.fabfile.org/en/1.6/. As it wraps ssh, it needs no special installation to the hosts.

Using fabric means you can execute the same task on multiple hosts easily. While you can use Puppet or Chef for this, they are a lot of less flexible to use than Fabric, (as they require setup and licenses).

Once you have setup a fabric file you will be able to connect to the host, su to a particular user, and invoke node -v and take action accordingly.

A more robust solution and scaleable solution though would be to host your own package repository, build your own node installation packages, and then use the whichever package manager (yum apt etc) that your linux hosts uses to run and update.

Happy node hacking.

Node Version Manager might fit your need.