Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How do I install node.js in Ubuntu? I've been looking around, and I can't find anything. Is there a Ubuntu package for node.js, or do I have to compile it myself?

share|improve this question

3 Answers

up vote 22 down vote accepted

You can use the official node.js PPA:

ppa:chris-lea/node.js Launchpad logo (Click here for instructions on using PPAs.)

If you're on Ubuntu Server, first do this:

sudo apt-get install python-software-properties

Then, do this:

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Then, you have the latest version of node.js installed.

share|improve this answer
12.10 now includes this so you can just run sudo apt-get install nodejs – hafichuk Oct 24 '12 at 16:12
1  
@hafichuk you've been able to do that for a few cycles now - however, getting it straight from the source (Official PPA) means you'll get better support and security updates. – jrg Oct 25 '12 at 0:36
Remember to run sudo apt-get update && sudo apt-get install python-software-properties if you are on ubuntu-server – Kieran Andrews Apr 2 at 2:37

Yes, go to Synaptic, search for "nodejs". The packages are located in the universe repository. I suggest you install all of the packages starting with nodejs if you are doing development.

Just in case that doesn't work:

sudo apt-get install g++ curl libssl-dev apache2-utils git-core
git clone git://github.com/joyent/node.git
cd node
./configure
make
sudo make install

That will download the sourcecode of node.js, make it and install it.

share|improve this answer
1  
Wouldn't "sudo apt-get build-dep nodejs" be more appropriate than your "apt-get install" line? – freddyb Jun 18 '11 at 16:10
@freddyb Doesn't hurt to have it like this. – nickguletskii Jun 18 '11 at 16:20
Thanks for your answer - however, I recently discovered that node.js has a "officially unofficial" PPA - so I answered with that, since it wouldn't be polite to rewrite your entire answer with the "correct" instructions. – jrg Nov 28 '11 at 1:23
However I prefer this solution instead of sudo apt-get install nodejs, this last doesn't give you the latest version. – Rubens Mariuzzo Jan 12 at 19:28

Node is one of the easier projects to build. Just change the version as that continues to change.

$ cd /usr/local/src
$ wget http://nodejs.org/dist/v0.8.21/node-v0.8.21.tar.gz
$ tar -xvzf node-v0.8.21.tar.gz
$ cd node-v0.8.21
$ ./configure
$ make
$ sudo make install
$ which node

You should see /usr/local/bin/node.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.