Fedora Linux Tutorials Ubuntu Uncategorized

Install Node.js On Linux From Source

You must have come across node.js, the latest technology mostly talked about with the Ruby on Rails framework. If you’re still wondering what the heck is this, I’m here to help you. Node.js is a run-time environment which can be used to create highly efficient applications in JavaScript. Node.js runs on server-side.

It is a lightweight and event-driven open source environment built on Chrome’s JavaScript runtime. Node.js runtime can be used on any major platform including Windows, Linux and OSX.

Node.js provides installers for Windows and OSX operating systems and the source code package for Linux. In this post you’ll learn how to install node.js from source code on Linux. You can follow along this post for any Linux distribution like Ubuntu, Fedora and derivatives of these like Linux Mint.

Install libssl-dev

Before installing node.js, you must have libssl-dev package installed in your system. It’s a security package which includes SSL development libraries and header files. If the package isn’t already installed, run the following command on Ubuntu Terminal.

sudo apt-get install libssl-dev

Download Node.js

It is possible that when you’re reading this post, Node.js has been updated to a new version. So, just visit the Node.js Downloads page and right click and copy the Source Code link.

Now enter the /tmp directory and download the package into it running the following command.

cd /tmp
wget http://nodejs.org/dist/v0.12.2/node-v0.12.2.tar.gz

Unzip Package

Once you’ve the node.js package downloaded, unzip it in the same directory. Use the following command to verbosely extract downloaded package.

tar -vxf node-v0.12.2.tar.gz

Replace node-v0.12.2.tar.gz with your package name.

Install

To install node.js, enter the newly created directory through the previous command.

cd node-v0.12.2

Configure

Run ./configure command check the prerequisites and other necessary files for installation. If you get a successful message, go to build step, or install the required packages.

Build

Next step is to build the source code. This step will take few minutes to complete. Run make command to build the source code.

The last step is installation. Install using following command with sudo access.

sudo make install

So now, we’ve Node.js installed on our system. To check this, run the following command which will tell the Node.js version installed on your system:

node -v

Great! In few easy steps, you’ve shiny new node.js installed on your Linux system build from latest version of source code.

Leave a Reply