Adriano's Place

Website & Blog of Adriano Chiaretta

Home Archives for nodejs

How to build the latest node.js RPM and install it on CentOS / RedHat / Fedora

Posted on November 23, 2012 Written by adriano Leave a Comment

How to build the latest node.js RPM and install it on CentOS / RedHat / Fedora

If you aren’t familiar with node.js, it’s a platform whose goal is to facilitate building event-driven server side javascript services. Essentially it allows to run javascript on the server — services built with Node.js go to sleep after instructing the operating system to wake them if a connection is made, and each connection has a very small memory footprint.

I recently started getting into nodejs, and first thing to figure out has been the best way to install it on a CentOS virtual server I had around, and here’s a summary of my findings.

In order to install nodejs on RedHat / CentOS / Fedora the most common approach is to grab the latest sources tarball and build them, and the instructions for this are on the online wiki. This will install node.js as an unmanaged package, making upgrade or uninstallation at times not super straightforward.

Which is why, on RedHat based distros (such as CentOS) I prefer going for handling software installations through RPM. In the past there were some ready-made node.js RPMs, but no new ones have been produced after version 0.6.18 (and we are now at 0.8.x).

So I went for building the RPMs myself, and listed below are the steps I went through.

– If your CentOS box doesn’t have compiler related components, install them with yum as usual:

yum groupinstall “Development tools”

– Install also the  gcc-c++ build tools (needed by the RPM build environment)

yum install gcc-c++

– Setup the RPM build environment, following what outlined on the CentOS wiki — afterward your home user’s folder show include the following subfolders:

– Download the latest node.js sources in the SOURCES folder

curl -sR -o ~/rpmbuild/SOURCES/node-v0.8.14.tar.gz http://nodejs.org/dist/v0.8.14/node-v0.8.14.tar.gz

– In order to build an RPM you’ll need its definition (.spec) file, and someone out there is kind enough to maintain one up to date with the latest node.js versions. Download it in the SPECS folder:

curl -sR -o ~/rpmbuild/SPECS/node-v0.8.14.spec https://github.com/kazuhisya/nodejs-rpm/raw/master/nodejs.spec

– At this point you’re ready to fire up rpmbuild:

rpmbuild -ba ~/rpmbuild/SPECS/node-v0.8.14.spec

– Depending on how fast your machine is, after a few minutes unless surprises the build and packaging process will complete and under ~/rpmbuild/RPMS/<architecture> you’ll find the node.js binaries and source RPMs.

– In my case, being the CentOS box a 64 bit one, I found what was looking for at: ~/rpmbuild/RPMS/x86_64/nodejs-0.8.14-1.el6.x86_64.rpm

– At last, time to install node.js:

rpm -ivh ~/rpmbuild/RPMS/x86_64/nodejs-0.8.14-1.el6.x86_64.rpm

– once installed, you can verify if things went correctly by checking that the “node” executable can be found within the path (doing a “which node”) and node –version which should output the version of the node binary just installed.

If you wish to cut a few corners and avoid the steps above, you can find the node.js 0.8.14 RPMs at this location (note that they have been built on an x64 CentOS 6.3 box — haven’t tried them on other versions or distros).

Filed Under: Tech Tips Tagged With: build, centos, featured, fedora, nodejs, redhat, rpm

About this blog

Welcome to my website! Here you'll find posts spanning from personal thougths, to tech tips, cooking recipes, and more. Essentially about anything I deem worth sharing. Learn More...

Connect

  • Email
  • Facebook
  • Google+
  • Linkedin
  • Pinterest
  • RSS
  • Twitter
  • YouTube

Keep in touch

Sign up to receive email updates and to hear what's going on with me!

Worth checking out

Craving for a sweet, soft, chilly, low carbs & low calories dessert? Then this approach I perfected after a few tryouts might just be what you're looking for, especially if you only have an … » read more...

Here are the steps necessary in order to have the SFTP subsystem of the SSH (secure shell) daemon log operations on disk. 1. edit /etc/ssh/sshd_confing and look for the line: Uncomment it … » read more...

If you aren't familiar with node.js, it's a platform whose goal is to facilitate building event-driven server side javascript services. Essentially it allows to run javascript on the server -- … » read more...

Recent Comments

  • What’s for Dessert? Mousse Re-imagined in 2-minutes… | Jedemi - Exploring the adjacent possible to help engage and empower on Two minutes milk & yogurt mousse
  • Thanks on Skype 4.1: how to disable quotes during copy-paste ops
  • ricardo on Skype 4.1: how to disable quotes during copy-paste ops
  • S. on Skype 4.1: how to disable quotes during copy-paste ops
  • Thanks on Skype 4.1: how to disable quotes during copy-paste ops

Latest Tweets

Tweets by @adri72

Shopping Ideas

Translate this page in…

Tag Cloud

adri72 adriano.ws amazon android app world bash Bay Area blackberry app world calories canon centos command line copy paste dell digital camera DVD favorite apps featured folders Google happy holidays imap iPhone iTunesConnect linux mac memory mousse pc photo gallery quotes RAM remote desktop server skype thunderbird tweet twitter unix web server weekly digest windows desktop windows explorer windows xp yogurt

Search this website

Copyright © 2018 · Focus Pro Theme on Genesis Framework · WordPress · Log in