Pankaj Pankaj - 4 months ago 44x
Node.js Question

how to install nodejs 0.10.26 from binaries in Ubuntu

I am new to linux and am trying to install nodejs latest version with binaries. The solutions I have looked up suggest the installation using apt-get on some private repositories(PPA), which I do not want to do.

So I ran the following commands:

tar -zxvf node-v0.10.26-linux-x64.tar.gz
mv node-v0.10.26-linux-x64 node-v0.10.26
sudo cp -r node-v0.10.26 /usr/local/src

After this, I don't really know what to do. I read an article which suggested created symbolic links, which I am kind of scared to mess up with without knowing the details.

Could you please give me a set of commands to run after this in order to install node with npm? I guess npm should be a part of this binary version.


The best way to install Node.js on Linux is to use these "semi-oficial" repositories:
I'm writing "semi-official" because, despite not being officially maintained by the Node.js team, these are widely used by the community. You can definitely trust them!

Anyway, if you want to install Node.js by yourself... There are various setups possible. A neat one, in my opinion, could be:

$ NODE_VERSION=v0.10.26
$ curl -LO$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.gz
$ tar xzf node-$NODE_VERSION-linux-x64.tar.gz
$ sudo cp -rp node-$NODE_VERSION-linux-x64 /usr/local/
$ sudo ln -s /usr/local/node-$NODE_VERSION-linux-x64 /usr/local/node

Then add /usr/local/node/bin to your $PATH (usually this involves altering the ~/.profile file; there are thousands of docs for how to do this).

The basic idea is to move the whole tarball into /usr/local. Then you create a symlink in /usr/local/node pointing to the most recent version.
If you need to update Node.js (suppose it's version 0.10.27), then, just extract the tarball in /usr/local and update the symbolic link so it points to the new one. You can then optionally remove the old folder.