To install Node.js, first install the below prerequisite and add the node.js repository.
# sudo apt-get install python-software-properties
# sudo apt-add-repository ppa:chris-lea/node.js
Now install Node.js and npm (the Node Packet Manager).
# sudo apt-get update
# sudo apt-get install nodejs npm
Thats it. Your Node.js is ready. Test by running the below command.
# node -v
v0.6.18
Node.js stable releases
are done quite frequently. To upgrade run,
# sudo apt-get update
# sudo apt-get upgrade nodejs npm
You could also use the Ubuntu Update Manager to do the update.
If you are the kind who prefers to directly build from the sources then,
# cd <directory>
# sudo wget http://nodejs.org/dist/v0.6.18/node-v0.6.18.tar.gz
# sudo tar -zxf node-v0.6.18.tar.gz
# cd node-v0.6.18
# sudo ./configure
# sudo make
# sudo make install
# node -v
v0.6.18
The latest version was v0.6.18 at the time of writing this post.
For other platforms, installation is simple. See the Node.js installation web page.
Hi! Thanks for the great instructions. I have a problem though. I'm trying to install the latest version of node on ubuntu and followed your instructions. However, it keeps saying that I have the latest version of node, even though when I node -v, it prints v0.5.11-pre. Any idea what could be going on?
ReplyDeleteThanks!
-Daron
Hi Daron, Thanks for reading.
ReplyDeleteI assume even this command shows v0.5.11-pre ?
$ dpkg -l | grep node
I have encountered the "You have the latest version of node" when trying apt-get update once earlier. I downloaded and built from the sources and it worked. Also ensure that you have all node processes killed before starting installation.
Pls let me know if this solved the problem, so that I go and update the above blog.