Monthly Archives: February 2012

Installing ZeroMQ with node.js

Recently, I installed zeromq with node.js and zeromq.node. I had some difficulties, so I thought that I would generate a brief how to.

ZeroMQ installed without much difficulty. On Ubuntu, install the following prerequisite.
apt-get install uuid-dev
On CentOS, install:
yum install libuuid-devel uuid-devel

Then, unpack the tarball and execute: configure, make
As the super user, execute: make install
This will install ZeroMQ in /usr/local/bin

Download and install the latest stable version of node.js. Just unpack the tarball and execute: configure, make
As the super user, execute: make install

The node.js library for 0mq is zeromq.node, and it does not work with the latest development branch of node.js. Rather, you need it install a stable branch of node.js.

Before you install zeromq.node do the following.
1. Make sure that /usr/local/bin is in your path, since there is where node lives.
2. Create the following file: /etc/ld.so.conf.d/zmq.conf
The contents of the above file is ‘/usr/local/lib’.
3. Execute the command ‘ldconfig’.
4. export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
5. npm install zmq

If you install zeromq.node (now called ‘zmq’) globally as the super user (with ‘npm install -g zmq’), node.js will likely not be able to find it (in /usr/local/lib/node_modules). So, install it locally as above in your $HOME/node_modules directory.

Now, you should have a working version of zmq with node.js. You can test your installation using the example scripts (e.g., producer.js) on Justin’s github: https://github.com/JustinTulloss/zeromq.node