Press "Enter" to skip to content

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

(http://www.rabbitmq.com/debian/)

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 http://www.rabbitmq.com/debian/ testing main

Then update the apt-get environment:

wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
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

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 http://hg.rabbitmq.com/rabbitmq-stomp/

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:

SERVER_START_ARGS='
  -pa /usr//lib/erlang/lib/rabbitmq-stomp/ebin
  -rabbit
     stomp_listeners [{"0.0.0.0",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)

6 Comments

  1. Robert J Berger Robert J Berger January 11, 2009

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

  2. Robert J Berger Robert J Berger January 23, 2009

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

  3. paul paul May 10, 2009

    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 [{“0.0.0.0″, 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?

    Thanks,

    Paul

  4. paul paul May 10, 2009

    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 🙁

  5. Mason Mason August 3, 2009

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

  6. Titi Titi December 14, 2009

    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.

Comments are closed.