RabbitMQ


This section describes the process for obtaining a copy of the RabbitMQ source code, as well as instructions for building the server and the client libraries from source.

Obtaining the source

Download a source code distribution from the download page.

Required Libraries and Tools

In order to build RabbitMQ, you will need a few tools. For building the server:

  • the Erlang development and runtime tools
  • a recent version of Python, for generating AMQP framing code from the AMQP XML specification
  • a recent version of GNU make

and for building the Java client libraries:

  • a Java compiler, for Java language version 1.5 or newer
  • Ant, version 1.6 or newer, including the optional ant-trax.jar (if you download ant from the above then this is included; if you are using the ant debian package then you also need to install the ant-optional package).

Building the source

The source code distribution is split into two main parts: the server code and the java client library code. Both make use of the included docs/specs directory, which contains the machine-readable AMQP protocol specification XML document.

Top-level Makefile

The top-level Makefile contains targets all, server, client, and clean. all will clean and then build everything. server and client will invoke the respective build targets for the server and client. clean will remove any built targets.

The top-level Makefile also contains a bunch of other targets which are used in preparing a release - these are unlikely to be of interest.

Building the server

Change to the erlang/rabbit directory, and type make.

Other interesting Makefile targets include

all
The default target. Builds the server.
run
Builds the server and starts an instance with an interactive Erlang shell. This will by default create a Mnesia database in /tmp/rabbit-mnesia, but this location can be overridden by setting the Makefile variable MNESIA_DIR:

make run MNESIA_DIR=/some/other/location/for/rabbit-mnesia

clean
Removes build products and wipes the Mnesia database directory used by the run target. See the above description of MNESIA_DIR.
dist
Builds the server and then constructs a directory containing a binary server distribution. By default, the distribution will be placed in ./dist, but this can be overridden by setting the DIST_DIR variable:

make dist DIST_DIR=/some/place/to/put/a/distribution

The server startup scripts are by default placed in $(DIST_DIR)/sbin, and this too can be overridden, by setting SBIN_DIR:

make dist DIST_DIR=/tmp/dist/usr/lib/erlang/lib/rabbitmq_server-version \
          SBIN_DIR=/tmp/dist/usr/sbin

Building the Java client libraries

Ensure JAVA_HOME is correctly set. Change to the java directory, edit config.properties.xml to fit your needs and type ant.

Other interesting build.xml targets include

build
The default target. Builds the client library classes into build/classes.
clean
Removes the entire build/ directory, including compiled classes, built jar files, and any distributions placed under build/dist.
jar
Builds a jar file from the client library classes into build/lib.
dist
Constructs a directory, by default build/dist, containing the RabbitMQ client jar files as well as all the libraries the AMQP client depends on from lib. The distribution output directory can be overridden by setting the Ant property dist.out to a new location:

ant -Ddist.out=/some/place/to/put/a/distribution dist