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
The best way to install Node.js on Linux is to use these "semi-oficial" repositories: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#ubuntu-mint-elementary-os
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 http://nodejs.org/dist/$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
/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.