How to compile Node.js from source with Ubuntu

UPDATE: Works with Node.js 0.6.6 and 0.6.7 on Ubuntu 11.10 (Oneiric Ocelot) / Linux Mint 12 (Lisa).

There are no pre-compiled packages for Linux, so if you want to use Node.js, you’ll have to build it yourself. It’s easy enough though, and here’s how.

Download and unpack Node.js Source

You can obtain the release version from their website or get an edgier version from their Git source repository. If you acquired it from the former source, you’ll need to decompress it first, for instance to /usr/local/src/.

(optional) Install the build tools

If you haven’t done this before, your system most likely won’t have the required tools for software compilation. You can easily install them: 

sudo apt-get install build-essential checkinstall 

(optional) Install openssl-dev

If you want to compile with SSL support (default), you’ll also need to install the OpenSSL Development Packages, like so:

sudo apt-get install libssl-dev

Build Node.js

Open up a terminal witndow and navigate to the directory that contains the Node.js source, e.g. /usr/local/src/node-0.6.6. And execute the following commands in succession: 

./configure
make
sudo make install

If all goes well, you should be able to access the node command from any terminal window.

Advertisements

One thought on “How to compile Node.js from source with Ubuntu

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s