AMQP server: RabbitMQ

RabbitMQ is an excellent low-level messaging server. You can use it with different technologies.


You need PostgreSQL + Python

apt-get install postgresql python3
apt-get install python3-amqplib


Add repository

You must add a new repository for RabbitMQ.

  • Even though the name is "testing" it's actually the latest stable version
  • They use "testing" as this is not in the "main" Ubuntu repo yet.


vim /etc/apt/sources.list

Add the new repository

deb testing main

Add repo key

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

Update package list

sudo apt-get update

Binary installation

apt-get install rabbitmq-server amqp-tools

Enable plugins

Enable RabbitMQ command line client

rabbitmq-plugins enable amqp_client

Enable web console

rabbitmq-plugins enable rabbitmq_management

Restart server to take on your changes

service rabbitmq-server restart

Now you can access RabbitMQ using the default ports:

Create administration user

Create new user, replace rtd by your username.

rabbitmqctl add_user rtd  strong_password

Set user rights

rabbitmqctl set_user_tags rtd administrator
rabbitmqctl set_permissions -p / rtd ".*" ".*" ".*"

Remove default guest user

rabbitmqctl delete_user guest

Restart service to take on your changes

service rabbitmq-server restart

Advanced configuration

Change port number


If activeMq is install, stop it

service activemq stop

Create or update the configuration file:

vim /etc/rabbitmq/rabbitmq-env.conf

Add the following at the beginning of the file


Restart server

service rabbitmq-server restart


You must let the OUTPUT unfiltered because RabbitMQ port is dynamic.

You have to open Input TCP 5672 (messages), TCP 15672 (web interface).

vi /etc/init.d/firewall

Add this rules

$IPT -A INPUT -p tcp --dport 15672 -j ACCEPT
$IPT -A INPUT -p tcp --dport 5672 -j ACCEPT

Update startup

The server should start at every reboot. The following hack is only required if your installation is old or buggy.

cd /etc/init.d/
update-rc.d rabbitmq-server defaults

Apache 2 proxy

You can put RabbitMQ behind a proxy using the following configuration:

Edit your Apache2 configuration:

vim /etc/apache2/sites-enabled/mySuperSite.conf

Set the following settings:

# Enable proxy
ProxyVia On
ProxyPreserveHost On
ProxyRequests Off
ProxyErrorOverride Off
<Proxy *>
    AddDefaultCharset off
    Order deny,allow
    Allow from all
    Satisfy Any

## Proxy to RabbitMQ
<Location /rabbitmq/>
   ProxyPass http://smartcard-mq:15672/
   ProxyPassReverse http://smartcard-mq:15672/
   Order deny,allow
   Deny from all
   Allow from