How to install ZeroMQ on Ubuntu

Before installing, make sure you have installed all the needed packages

sudo apt-get install libtool pkg-config build-essential autoconf automake
sudo apt-get install libzmq-dev

Install libsodium

git clone git://
cd libsodium
./configure && make check
sudo make install
sudo ldconfig

Install zeromq

# latest version as of this post is 4.1.2
tar -xvf zeromq-4.1.2.tar.gz
cd zeromq-4.1.2
./configure && make check
sudo make install
sudo ldconfig

Verify to see if zeromq installed correctly

I’m familiar with Node.js so I’m going to use the Node.js hwserver example from zeromq’s website. If you see “Listening on 5555…”, you’re good to go.

// Hello World server
// Binds REP socket to tcp://*:5555
// Expects "Hello" from client, replies with "world"

var zmq = require('zmq');

// socket to talk to clients
var responder = zmq.socket('rep');

responder.on('message', function(request) {
  console.log("Received request: [", request.toString(), "]");

  // do some 'work'
  setTimeout(function() {

    // send reply back to client.
  }, 1000);

responder.bind('tcp://*:5555', function(err) {
  if (err) {
  } else {
    console.log("Listening on 5555…");

process.on('SIGINT', function() {