Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to use nodejs on a linode machine that has debian lenny installed. I want to have the latest version of nodejs and npm as well.

apt-get does not seem to know nodejs or possibly I don't know how to use it.

in here: http://nodejs.org/dist/v0.6.6/ i see many files but I don't know which of them I should use for the install (nor how).

I am guessing that I need node-v0.6.6.pkg but again, this is just a guess and I don't know how to continue from here.

thanks.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The .pkg file is for OSX. There are some repositories that have binaries for Debian, but it is probably easiest to download and compile the code. NodeJS is updated very frequently - so most repositories have very outdated versions. You will need some development tools (compiler, etc.) to be able to build the source.

sudo apt-get update
sudo apt-get install curl build-essential openssl libssl-dev

You can either download the source from the Node.JS site or pull it from github. The advantage of the latter is ease of maintenance.

NodeJS:

If you wish, you can install node to a directory other than the default, by adding --prefix /path/to/install/directory to your configure line, below. (Only use one of the following, not both)

From GitHub:

sudo apt-get install git-core
cd /usr/local/src ##or whatever directory you like#
git clone https://github.com/joyent/node.git && cd node
./configure
make
sudo make install

From source - tarball:

cd /usr/local/src ##or whatever directory you like#
wget http://nodejs.org/dist/v0.6.6/node-v0.6.6.tar.gz
tar -xzvf node-v0.6.6.tar.gz
cd node-v0.6.6
./configure
make
sudo make install

NPM:

NPM is already included with recent versions of node. Verify that it is installed with npm -v. If a version is displayed, there is no need to do the step below. If the 'easy install' doesn't work for you, you can also download the code and make install.

curl http://npmjs.org/install.sh | sudo sh
share|improve this answer
    
any pointers to how I get the required tools? (apt-get what?) what does ##you may want to set --prefix# mean ? also for some reason curl does not work for me (or maybe I have a bigger problem with apt-get), can you offer help with it as well ? (see stackoverflow.com/questions/8634487/… ) –  epeleg Dec 26 '11 at 23:03
1  
I believe the tools for building node on debian include: curl build-essential openssl libssl-dev. The --prefix is the location to which to install node (also add 'sudo' before make install), if you do not wish to go with the default. There are many variations on the npm installation - npm actually comes with node in the recent versions. Your other question would be a better fit for ServerFault than StackOverflow. I am more of a CentOS person, so can't offer much help with apt-get, however I'd start with fixing your key issue; 473041FA is the squeeze key: ftp-master.debian.org/keys.html –  cyberx86 Dec 27 '11 at 4:13
    
cyberx86, thank you. Inded I went to figure out what is wrong with the keys (mine was lenny though) and I ended up using aptitude install debian-keyring debian-archive-keyring followed by apt-get update and now everything seems to work o.k. and apt-get install curl works just fine. –  epeleg Dec 27 '11 at 6:31
    
cyberx86, re --prefix , do you know where would the default installation be? –  epeleg Dec 27 '11 at 7:29
    
On most systems it is /usr/local (and the files install to /usr/local/sbin). If you have installed it, you can try a whereis node for the system to locate it for you (or a find if that doesn't work). Typically, it should be fine to go with the default, unless you have reason to change it. –  cyberx86 Dec 27 '11 at 7:46
add comment

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.