Menu

Installing on Debian and Ubuntu

Overview

rabbitmq-server is included in standard Debian and Ubuntu repositories. However, the versions included are usually months behind RabbitMQ releases.

There are two ways to install the most recent version of RabbitMQ:

The following guide focuses on RabbitMQ installation on Debian and Debian-derived distributions such as Ubuntu. It covers a number of topics:

and more.

Supported Distributions

Below is a list Debian-based distributions supported by RabbitMQ 3.7.x packages:

  • Ubuntu 14.04 through 18.04
  • Debian Buster
  • Debian Stretch
  • Debian Jessie
The package may work on other Debian-based distributions if dependencies (see below) are satisfied (e.g. using the Wheezy backports repository) but their testing and support is done on a best effort basis.

User Privilege Requirements

RabbitMQ Debian package will require sudo privileges to install and manage. In environments where sudo isn't available, consider using the generic binary build instead.

Erlang/OTP Repositories

RabbitMQ needs Erlang/OTP to run. Erlang/OTP packages in standard Debian and Ubuntu repositories can be out of date and not supported by modern RabbitMQ versions.

Most recent Erlang/OTP release series are available from a number of alternative apt repositories:

Erlang Release Series Repositories that provide it Notes
21.x Supported starting with 3.7.7. See Erlang compatibility guide.
20.x Supported starting with 3.6.11. See Erlang compatibility guide.

Package Dependencies

When installing with apt, all dependencies other than Erlang/OTP should be met automatically in recent distributions (e.g. Ubuntu 16.04 or later, Debian Stretch). When that's not the case, dependency packages should be available from an appropriate backports repository. However, when installing via dpkg that's not the case. Below is the list of dependencies of RabbitMQ server as of 3.7.0:

  • erlang-nox (>= 1:19.3-1) | esl-erlang (>= 1:19.3-1). Erlang can installed from the Bintray Erlang repository maintained by the RabbitMQ team, or Erlang Solutions apt repo, or Debian-based distribution backport repositories, or standard distribution repositories depending on the distribution used.
  • init-system-helpers (>= 1.13~). Required for systemd support.
  • socat
  • adduser
  • logrotate

Using Recent Erlang Package Repository on Bintray

Standard Debian and Ubuntu repositories tend to provide outdated versions of Erlang/OTP. Team RabbitMQ maintains an apt repository that includes packages of modern Erlang/OTP releases for a number of commonly used Debian and Ubuntu distributions:

  • Ubuntu 18.04 (Bionic)
  • Ubuntu 16.04 (Xenial)
  • Debian Stretch
  • Debian Jessie

The repo provides most recent patch releases in the following Erlang series:

  • 21.x
  • 20.3.x
  • 19.3.x
  • master (22.x)
  • R16B03 (16.x)

Signing Key

In order to use the repository, add a key used to sign RabbitMQ releases to apt-key:

wget -O - 'https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc' | sudo apt-key add -
This will instruct apt to trust packages signed by that key.

Source List File

As with all 3rd party Apt (Debian) repositories, a file describing the repository must be placed under the /etc/apt/sources.list.d/ directory. /etc/apt/sources.list.d/bintray.erlang.list is the recommended location. The file should have a source (repository) definition line that uses the following pattern:

# See below for supported distribution and component values
deb https://dl.bintray.com/rabbitmq/debian $distribution $component
The next couple of sections discuss what distribution and component values are supported.

Distribution

In order to set up an apt repository that provides the correct package, a few decisions have to be made. One is determining the distribution name. It comes from the Debian or Ubuntu release used:

  • bionic for Ubuntu 18.04
  • xenial for Ubuntu 16.04
  • stretch for Debian Stretch
  • jessie for Debian Jessie

Erlang/OTP Version

Another is what Erlang/OTP release version should be provisioned. It is possible to track a specific series (e.g. 20.x) or install the most recent version available. The choice determines what Debian repository component will be configured. Consider the following repository file at /etc/apt/sources.list.d/bintray.erlang.list:

deb http://dl.bintray.com/rabbitmq/debian bionic erlang
It configures apt to install the most recent Erlang/OTP version available in the repository and use packages for Ubuntu 18.04 (Bionic).

For Debian Stretch the file would look like this:

deb http://dl.bintray.com/rabbitmq/debian stretch erlang
To use the most recent 20.x patch release available, switch the component to erlang-20.x:
deb http://dl.bintray.com/rabbitmq/debian bionic erlang-20.x
erlang-21.x, erlang-19.x, and erlang-16.x are the components for Erlang 21.x, 19.x and R16B03, respectively.

Installations that target erlang will install the most recent generally available (GA) patch release.

Installing Erlang Packages

After updating the list of apt sources it is necessary to run apt-get update:
sudo apt-get update
Then packages can be installed just like with the standard Debian repositories:
# or "erlang"
sudo apt-get install erlang-nox

Erlang Version and Repository Pinning

When the same package (e.g. erlang-nox) is available from multiple apt repositories operators need to have a way to indicate what repository should be preferred. It may also be desired to restrict Erlang version to avoid undesired upgrades. apt package pinning can be used to address both problems.

Package pinning is configured with a file placed under the /etc/apt/preferences.d/ directory, e.g. /etc/apt/preferences.d/erlang. After updating apt preferences it is necessary to run apt-get update:

sudo apt-get update

The following preference file example will configure apt to install erlang-* packages from Bintray and not standard Debian or Ubuntu repository:

# /etc/apt/preferences.d/erlang
Package: erlang*
Pin: release o=Bintray
Pin-Priority: 1000
This apt preference configuration is recommended when the erlang repository component is used.

Effective package pinning policy can be verified with

sudo apt-cache policy

The following preference file example will pin all erlang-* packages to 20.3.8.2 (assuming package epoch for the package is 1):

# /etc/apt/preferences.d/erlang
Package: erlang*
Pin: version 1:20.3.8.2-1
Pin-Priority: 1000
The following preference file example will pin esl-erlang package to to 20.3.6 (assuming package epoch for the package is 1):
# /etc/apt/preferences.d/erlang
Package: esl-erlang
Pin: version 1:20.3.6
Pin-Priority: 1000

Using RabbitMQ Package Repository on Bintray

RabbitMQ packages can be installed from apt (Debian) repositories on Bintray or Package Cloud.

Using Bintray Apt Repository

When using the repository on Bintray it is recommended that Erlang/OTP is also installed from Bintray.

Source List File

As with all 3rd party apt repositories, a file describing the repository must be placed under the /etc/apt/sources.list.d/ directory. /etc/apt/sources.list.d/bintray.rabbitmq.list is the recommended location. The file should have a source (repository) definition line that uses the following pattern:

# See below for supported distribution and component values
deb https://dl.bintray.com/rabbitmq/debian $distribution main
The next couple of sections discusses what distribution and component values are supported.

Distribution

In order to set up an apt repository that provides the correct package, a few decisions have to be made. One is determining the distribution name. It comes from the Debian or Ubuntu release used:

  • bionic (Ubuntu 18.04)
  • artful
  • trusty
  • sid
  • buster
  • stretch
  • jessie
  • xenial (Ubuntu 16.04)
  • yakkety
  • zesty

To add the apt repository to the source list directory (/etc/apt/sources.list.d), use:

echo "deb https://dl.bintray.com/rabbitmq/debian {distribution} main" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list
where {distribution} is the name of the Debian or Ubuntu distribution used (see above).

So, on Ubuntu 18.04 the above command becomes

echo "deb https://dl.bintray.com/rabbitmq/debian bionic main" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list
and on Ubuntu 16.04 it would be
echo "deb https://dl.bintray.com/rabbitmq/debian xenial main" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list

Signing Key

In order to use the repository, add a key used to sign RabbitMQ releases to apt-key:

wget -O - 'https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc' | sudo apt-key add -
This will instruct apt to trust packages signed by that key.

Installing Erlang Packages

After updating the list of apt sources it is necessary to run apt-get update:
sudo apt-get update
Then packages can be installed just like with the standard Debian repositories:
sudo apt-get install rabbitmq-server

Using PackageCloud Apt Repository

PackageCloud is another distribution channel that provides an apt repository. A quick way to install uses a Package Cloud-provided script.

There are more installation options available:

  • Using PackageCloud Chef cookbook
  • Using PackageCloud Puppet module
  • Manually
See PackageCloud RabbitMQ repository instructions.

Package Cloud signs distributed packages using their own GPG key.

Package Cloud Debian repository can be used in combination with Erlang installed from the Bintray repository.

Download the Server

In some cases it may easier to download the package and install it manually. The package can be downloaded from Bintray or GitHub.

DescriptionDownload  
.deb for Debian-based Linux (from Bintray) rabbitmq-server_3.7.7-1_all.deb(Signature)
.deb for Debian-based Linux (from GitHub) rabbitmq-server_3.7.7-1_all.deb

Installation via apt repositories on Bintray and Package Cloud is recommended over downloading the package directly and installing via dpkg -i. When the RabbitMQ package is installed manually with dpkg -i the operator is responsible for making sure that all package dependencies are met.

Run RabbitMQ Server

Start the Server

The server is started as a daemon by default when the RabbitMQ server package is installed. It will run as a non-privileged user rabbitmq.

As an administrator, start and stop the server as usual for Debian-based systems: service rabbitmq-server start.

Configuring RabbitMQ

On most systems, a node should be able to start and run with all defaults. Please refer to the Configuration guide to learn more and Production Checklist for guidelines beyond development environments.

Note: The server is set up to run as system user rabbitmq. If you change the location of the node database or the logs, you must ensure the files are owned by this user (and also update the environment variables).

Port Access

SELinux, and similar mechanisms may prevent RabbitMQ from binding to a port. When that happens, RabbitMQ will fail to start. Firewalls can prevent nodes and CLI tools from communicating with each other. Make sure the following ports can be opened:

  • 4369: epmd, a peer discovery service used by RabbitMQ nodes and CLI tools
  • 5672, 5671: used by AMQP 0-9-1 and 1.0 clients without and with TLS
  • 25672: used for inter-node and CLI tools communication (Erlang distribution server port) and is allocated from a dynamic range (limited to a single port by default, computed as AMQP port + 20000). Unless external connections on these ports are really necessary (e.g. the cluster uses federation or CLI tools are used on machines outside the subnet), these ports should not be publicly exposed. See networking guide for details.
  • 35672-35682: used by CLI tools (Erlang distribution client ports) for communication with nodes and is allocated from a dynamic range (computed as server distribution port + 10000 through server distribution port + 10010). See networking guide for details.
  • 15672: HTTP API clients, management UI and rabbitmqadmin (only if the management plugin is enabled)
  • 61613, 61614: STOMP clients without and with TLS (only if the STOMP plugin is enabled)
  • 1883, 8883: (MQTT clients without and with TLS, if the MQTT plugin is enabled
  • 15674: STOMP-over-WebSockets clients (only if the Web STOMP plugin is enabled)
  • 15675: MQTT-over-WebSockets clients (only if the Web MQTT plugin is enabled)
It is possible to configure RabbitMQ to use different ports and specific network interfaces.

Default user access

The broker creates a user guest with password guest. Unconfigured clients will in general use these credentials. By default, these credentials can only be used when connecting to the broker as localhost so you will need to take action before connecting from any other machine.

See the documentation on access control for information on how to create more users, delete the guest user, or allow remote access to the guest user.

Controlling System Limits on Linux

RabbitMQ installations running production workloads may need system limits and kernel parameters tuning in order to handle a decent number of concurrent connections and queues. The main setting that needs adjustment is the max number of open files, also known as ulimit -n. The default value on many operating systems is too low for a messaging broker (eg. 1024 on several Linux distributions). We recommend allowing for at least 65536 file descriptors for user rabbitmq in production environments. 4096 should be sufficient for most development workloads.

There are two limits in play: the maximum number of open files the OS kernel allows (fs.file-max) and the per-user limit (ulimit -n). The former must be higher than the latter.

With systemd (Recent Linux Distributions)

On distributions that use systemd, the OS limits are controlled via a configuration file at /etc/systemd/system/rabbitmq-server.service.d/limits.conf, for example:

[Service]
LimitNOFILE=300000

Without systemd (Older Linux Distributions)

The most straightforward way to adjust the per-user limit for RabbitMQ on distributions that do not use systemd is to edit the /etc/default/rabbitmq-server (provided by the RabbitMQ Debian package) or rabbitmq-env.conf to invoke ulimit before the service is started.

ulimit -S -n 4096

This soft limit cannot go higher than the hard limit (which defaults to 4096 in many distributions). The hard limit can be increased via /etc/security/limits.conf. This also requires enabling the pam_limits.so module and re-login or reboot.

Note that limits cannot be changed for running OS processes.

For more information about controlling fs.file-max with sysctl, please refer to the excellent Riak guide on open file limit tuning.

Verifying the Limit

RabbitMQ management UI displays the number of file descriptors available for it to use on the Overview tab.

rabbitmqctl status
includes the same value.

The following command

cat /proc/$RABBITMQ_BEAM_PROCESS_PID/limits
can be used to display effective limits of a running process. $RABBITMQ_BEAM_PROCESS_PID is the OS PID of the Erlang VM running RabbitMQ, as returned by rabbitmqctl status.

Configuration Management Tools

Configuration management tools (e.g. Chef, Puppet, BOSH) provide assistance with system limit tuning. Our developer tools guide lists relevant modules and projects.

Managing the Broker

To stop the server or check its status, etc., you can use package-specific scripts (e.g. the service tool) or invoke rabbitmqctl (as an administrator). It should be available on the path. All rabbitmqctl commands will report the node absence if no broker is running.

  • Invoke rabbitmqctl stop to stop the server.
  • Invoke rabbitmqctl status to check whether it is running.

More info on rabbitmqctl.

Logging

Output from the server is sent to a RABBITMQ_NODENAME.log file in the RABBITMQ_LOG_BASE directory. Additional log data is written to RABBITMQ_NODENAME-sasl.log.

The broker always appends to the log files, so a complete log history is retained.

You can use the logrotate program to do all necessary rotation and compression, and you can change it. By default, this script runs weekly on files located in default /var/log/rabbitmq directory. See /etc/logrotate.d/rabbitmq-server to configure logrotate.

Getting Help and Providing Feedback

If you have questions about the contents of this guide or any other topic related to RabbitMQ, don't hesitate to ask them on the RabbitMQ mailing list.

Documentation feedback is also very welcome on the list. If you'd like to contribute an improvement to the site, its source is available on GitHub.