Deploying RabbitMQ and Stomp on Ubuntu

Install rabbitmq via synaptic

Make sure that the erlang package is installed

Add a repository from the rabbitmq site

Set up Repository via the Synaptic GUI tool


Synaptic repository addition

Synaptic repository addition

Set up Repository via command line

Ubuntu Documentation for Managing Repositories via the Command Line

How to use the RabbitMQ Debian repository and available RabbitMQ Debian packages

The repositories are described in /etc/apt/sources.list

So do the following:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

Edit /etc/apt/sources.list and add the following line:

deb testing main

Then update the apt-get environment:

sudo apt-key add rabbitmq-signing-key-public.asc
sudo apt-get update

Install the RabbitMQ Server

Set up Repository via the Synaptic GUI tool

Synaptic Erlang Packages

Synaptic Erlang Packages

Set up Repository via command line

sudo apt-get install rabbitmq-server

This should have installed the main portion of the code base in /usr/lib/erlang/lib/rabbitmq_server-1.5.1 (The trailing version number may be different than 1.5.1)

After it installed the server, make sure its stopped

# /etc/init.d/rabbitmq-server stop

Install rabbitmq-stomp

I could not find any ubuntu/debian packages so I installed it from the Mercurial repository. If you don’t already have Mercurial (the hg command) then you can install it with the following command:

apt-get install mercurial

Install the rabbitmq-stomp code

This also will go parallel to where the ubuntu package put the stomp server main code and the rabbit-codegen.

cd /usr/lib/erlang/lib/
hg clone

Compile the stomp code

Build and test run rabbitmq and stomp via make

cd /usr/lib/erlang/lib/rabbitmq-stomp
make RABBIT_SERVER_SOURCE_ROOT=../rabbitmq_server-1.5.1 all

This should produce an output like:

mkdir -p ebin
erlc -I ../rabbitmq_server-1.5.0/include -I include -o ebin -Wall +debug_info  src/rabbit_stomp.erl
erlc -I ../rabbitmq_server-1.5.0/include -I include -o ebin -Wall +debug_info  src/stomp_frame.erl 

Add a file /etc/default/rabbitmq and Restart rabbitmq_server

You need to tell the main rabbitmq_server to load and run the rabbitmq-stomp stuff when it starts up. You do that by creating this file with the following content:

  -pa /usr//lib/erlang/lib/rabbitmq-stomp/ebin
     stomp_listeners [{"",61613}]
     extra_startup_steps [{"STOMP-listeners",rabbit_stomp,kickstart,[]}]'

Restart the Rabbitmq_server:

/etc/init.d/rabbitmq_server start

You can do a

ps -ax | grep stomp

and see an erlang process that is running the rabbit-stomp process.

Install ruby stomp client code and test

Install the ruby stomp gems

If you don’t have ruby already installed:

sudo apt-get install ruby
sudo apt-get install rubygems

Then install the ruby stomp gem

sudo gem install stomp

Run the ruby receiver client in one window

ruby /usr/lib/erlang/lib/rabbit-stomp/examples/ruby/cb-receiver.rb

In another window run the ruby sender client

ruby /usr/lib/erlang/lib/rabbit-stomp/examples/ruby/cb-sender.rb

In the receiver window you should see 10,000 test message lines:

Test Message number 9998
Test Message number 9999
All Done!

That’s it! Now you can use Stomp

(See later post Updating RabbitMQ and RabbitMQ-Stomp to RabbitMQ 1.5.3)

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • LinkedIn
  • Slashdot
  • Suggest to Techmeme via Twitter

6 comments to Deploying RabbitMQ and Stomp on Ubuntu

  • Did some major tweaks to this after trying it again. Its cleaner now (and works as stated!)

  • Add stuff to show how to install rabbitmq ubuntu package via command line

  • paul

    Hi Robert,

    Thanks for this post.

    I followed all the steps on my Ubuntu 9.04 server, but I don’t see the rabbit-stomp process(es):

    rabbitmq 4809 0.0 0.0 1992 352 ? S 12:01 0:00 /usr/lib/erlang/erts-5.6.5/bin/epmd -daemon
    rabbitmq 8663 2.6 1.5 15412 7992 ? Ssl 12:20 0:00 /usr/lib/erlang/erts-5.6.5/bin/beam -W w -K true -A30 — -root /usr/lib/erlang -progname erl — -home /var/lib/rabbitmq -pa /usr/lib/rabbitmq/bin/../ebin -noshell -noinput -s rabbit -sname rabbit -boot start_sasl -kernel inet_default_listen_options [{nodelay,true},{sndbuf,16384},{recbuf,4096}] -kernel inet_default_connect_options [{nodelay,true}] -rabbit tcp_listeners [{"", 5672}] -sasl errlog_type error -kernel error_logger {file,”/var/log/rabbitmq/rabbit.log”} -sasl sasl_error_logger {file,”/var/log/rabbitmq/rabbit-sasl.log”} -os_mon start_cpu_sup true -os_mon start_disksup false -os_mon start_memsup false -os_mon start_os_sup false -os_mon memsup_system_only true -os_mon system_memory_high_watermark 0.95 -mnesia dir “/var/lib/rabbitmq/mnesia/rabbit” -noshell -noinput
    rabbitmq 8763 0.0 0.0 1784 412 ? Ss 12:20 0:00 /usr/lib/erlang/lib/os_mon-2.1.8/priv/bin/cpu_sup

    Any ideas what’s wrong?



  • paul

    Instead of creating /etc/default/rabbitmq I created /etc/default/rabbitmq and now, after restarting rabbitmq I see the stomp when I do a ‘ps’.

    However, when I start up the receieve script, I get this error:

    # ruby /usr/lib/erlang/lib/rabbitmq-stomp/examples/ruby/cb-receiver.rb

    /var/lib/gems/1.8/gems/stomp-1.1/lib/stomp/connection.rb:243:in `write’: Broken pipe (Errno::EPIPE)
    from /var/lib/gems/1.8/gems/stomp-1.1/lib/stomp/connection.rb:243:in `puts’
    from /var/lib/gems/1.8/gems/stomp-1.1/lib/stomp/connection.rb:243:in `_transmit’
    from /var/lib/gems/1.8/gems/stomp-1.1/lib/stomp/connection.rb:242:in `synchronize’
    from /var/lib/gems/1.8/gems/stomp-1.1/lib/stomp/connection.rb:242:in `_transmit’
    from /var/lib/gems/1.8/gems/stomp-1.1/lib/stomp/connection.rb:231:in `transmit’
    from /var/lib/gems/1.8/gems/stomp-1.1/lib/stomp/connection.rb:118:in `subscribe’
    from /usr/lib/erlang/lib/rabbitmq-stomp/examples/ruby/cb-receiver.rb:5

    Darn :(

  • Mason

    I, too, receive the dreaded broken pipe that Paul describes. It’s like the socket isn’t staying open after initial authentication.

  • Titi

    A couple things I needed to do differently to get things to work:

    1. “/etc/init.d/stomp-server” instead of “/etc/init.d/stomp_server”
    2. I needed to put the SERVER_START_ARGS in /etc/rabbitmq/rabbitmq.conf (I just symlinked the /etc/default/rabbitmq I had created per your instructions.)
    3. “ps ax” instead of “ps -ax”

    It would be nice to add the “hg update rabbitmq_v1_X_X” info to this page as it’s a pretty important step.

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>