how to install nodejs 0.10.26 from binaries in Ubuntu

The best way to install Node.js and have the latest version (or any other version that you prefer, be it LTS or "current") is to download the official binary bundle and uncompress it. A neat way to do it:

# Use version 0.10.26
$ NODE_VERSION="v0.10.26"

# To use a newer version, for example 6.10.3, use instead:
$ NODE_VERSION="v6.10.3"

$ 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

The basic idea is to move all the contents of the archive into /usr/local, then create a symlink in /usr/local/node pointing to the most recent version.

For enabling the use of the "node" executable from the command line without referencing the full path (/usr/local/node/bin/node), add /usr/local/node/bin to your $PATH (usually this involves altering the ~/.bash_profile or ~/.profile file; there's plenty of docs for how to do this).

If you need to update Node.js (suppose it's version 7.10.0), 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.

May 2017 update

As of the "Creators Update", the commands above can now work also on Windows 10 using the "Windows Subsystem for Linux" (via bash). On Ubuntu on Windows 10, after creating the symlink like above, to add the folder to your $PATH add PATH="/usr/local/node/bin:$PATH" in the ~/.bashrc file.

Tags:

Ubuntu

Node.Js