Saturday, September 28, 2013

Building and installing NodeJS on Ubuntu 12.10 ... for noobs (like me)

So I'm a .NET guy and not that much of an expert on Linux. However, recent projects renewed my enthousiasm for JavaScript (AngularJS and KnockOut). Looking at some JavaScript best practices quickly leads to looking into testing and often the testing is done command line and requires NodeJS to be installed.

Obviously, I could have just installed Node on my windows machine (which seems to be possible and is supposed to be very easy), but I'll do it on my Ubuntu Server instance just because I can (or learn). And I found a nice video that walks me through the process: http://www.youtube.com/watch?v=ogprXGQWrQk

So, let's get started. I fired up my Ubuntu and I've read you need to start updating the package manager:

sudo apt-get update
sudo apt-get install git build-essential wget

Now get the latest version of Node and download it to you machine

wget http://nodejs.org/dist/v0.10.18/node-v0.10.18.tar.gz

Untar it 
tar xvf node-v0.10.18.tar.gz

Which is e(x)tract, (v)erbose output and (f) file as input.

Go into the folder 
cd node-v0.10.18
./configure

make
sudo make install

OK - the compilation was quite slow and took more than 10 minutes. I noticed in my vSphere client that only 1 processor was running out of the 8 that the VM has available to it. So Googling resulted in:

make -j
sudo make install

To use all cores. Building Node now only took 2 minutes... NICE. And yes - it worked right away! Piece of cake this.


No comments:

Post a Comment