Enide Studio

Node.js installation on CentOS/Linux

30 August 2013

by Paul Verest

NOTE: This is open-source article, that you can extend.

For Windows and MacOS Joyent provides standard packages. Just download from http://www.nodejs.org/download/. However for Linux things are a bit complicated.

Used materials: - https://www.digitalocean.com/community/articles/how-to-install-and-run-a-node-js-app-on-centos-6-4-64bit - https://github.com/joyent/node/wiki/Installation

Node.js installation on CentOS/Linux

A straightforward way, that works on any Linux, is to compile sources. There are also pre-built packages for some Lunix distribution, see Node Wiki Installing-Node.js-via-package-manager But the later is not maintained be Joyent (company behing Node), so support & freshness level may vary.

Preparation

yum -y update
yum -y groupinstall "Development Tools"

or with Package Manager (GUI)

Node.js installation CheatSheet

cd /usr/src

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

tar zxf node-v0.10.17.tar.gz
cd node-v0.10.17

./configure

It will read the properties of our system to prepare compiler flags. Ie. it could be a system architecture (32/64bit, CPU specific flags etc). With it, we're ready to actually compile the source now. To do that, just type:

make

This is probably the most time-consuming task here: on my example droplet it took about 6 minutes and 34 seconds to complete. When we're done, we need to make this available system-wide:

make install

As Node Wiki says

tar -zxf node-v0.6.18.tar.gz #Download this from nodejs.org
cd node-v0.6.18
./configure && make && sudo make install

or with git

git clone https://github.com/joyent/node.git
cd node
git checkout v0.6.18 #Try checking nodejs.org for what the stable version is
./configure && make && sudo make install

Other

This http://www.chrisabernethy.com/installing-node-js-on-centos-redhat/ suggests using Node.js spec file. Well, maybe for someone this way is better.

comments powered by Disqus