1

Installing on Debian and Ubuntu

 2 years ago
source link: https://rabbitmq.com/install-debian.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Installing on Debian and Ubuntu

Overview

This guide covers RabbitMQ installation on Debian, Ubuntu and distributions based on one of them.

RabbitMQ is included in standard Debian and Ubuntu repositories. However, the versions included are many releases behind latest RabbitMQ releases and may provide RabbitMQ versions that are already out of support.

Team RabbitMQ produces our own Debian packages and distributes them using Cloudsmith and PackageCloud.

Key sections of this guide are

Supported Erlang versions will be provisioned from one of the modern Erlang apt repositories on Ubuntu Launchpad or Cloudsmith.io.

Those looking for a more detailed description of the installation steps performed should refer to

Service management is covered in

More advanced topics include

How to Install Latest RabbitMQ on Debian and Ubuntu

With Apt

There are two options available for installing modern RabbitMQ on Debian and Ubuntu:

Both options will install a modern version of Erlang using Erlang apt repositories on Cloudsmith or Launchpad.

Manually Using Dpkg

Alternatively, the package can be downloaded manually and installed with dpkg -i. This option will require manual installation of all RabbitMQ package dependencies and is highly discouraged.

Supported Distributions

RabbitMQ is supported on several major Debian-based distributions that are still supported by their primary vendor or developer group.

For Debian, this means that RabbitMQ core team focus around package is on the current and prior release of Debian-based distributions, i.e. inline with distribution EOL policy.

Currently the list of supported Debian-based distributions includes

  • Ubuntu 18.04 through 21.04
  • Debian Buster (10), Bullseye (11), and Sid ("unstable")

The package may work on other Debian-based distributions if dependencies are satisfied (e.g. using a backports repository) but their testing and support is done on a best effort basis.

Where to Get Recent Erlang Version on Debian and Ubuntu

RabbitMQ needs Erlang/OTP to run. Erlang/OTP packages in standard Debian and Ubuntu repositories can be significantly 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 Apt Repositories that provide it Notes 24.x Supported starting with 3.8.16. See Erlang compatibility guide.

23.x Supported starting with 3.8.4. See Erlang compatibility guide.

This guide will focus on the Debian repositories maintained by Team RabbitMQ on Launchpad and on Cloudsmith.io.

Using RabbitMQ Apt Repositories on PackageCloud

Team RabbitMQ maintains an apt repository on PackageCloud, a package hosting service. It provides packages for most recent RabbitMQ releases.

PackageCloud provides repository setup instructions that include a convenient one-liner. Please always inspect scripts that are downloaded from the Internet and executed via a privileged shell!

Note that the PackageCloud script does not currently follow Debian best practices in terms of GPG key handling and the rest of this section does.

This guide will focus on a more traditional and explicit way of setting up an additional apt repository and installing packages.

All steps covered below are mandatory unless otherwise specified.

PackageCloud Quick Start Script

Below is shell snippet that performs those steps. They are documented in more detail below.

#!/usr/bin/sh

sudo apt-get install curl gnupg apt-transport-https -y

## Team RabbitMQ's main signing key
curl -1sLf "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/com.rabbitmq.team.gpg > /dev/null
## Launchpad PPA that provides modern Erlang releases
curl -1sLf "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xf77f1eda57ebb1cc" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg > /dev/null
## PackageCloud RabbitMQ repository
curl -1sLf "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/io.packagecloud.rabbitmq.gpg > /dev/null

## Add apt repositories maintained by Team RabbitMQ
sudo tee /etc/apt/sources.list.d/rabbitmq.list <<EOF
## Provides modern Erlang/OTP releases
##
## "bionic" as distribution name should work for any reasonably recent Ubuntu or Debian release.
## See the release to distribution mapping table in RabbitMQ doc guides to learn more.
deb [signed-by=/usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg] http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu bionic main
deb-src [signed-by=/usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg] http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu bionic main

## Provides RabbitMQ
##
## "bionic" as distribution name should work for any reasonably recent Ubuntu or Debian release.
## See the release to distribution mapping table in RabbitMQ doc guides to learn more.
deb [signed-by=/usr/share/keyrings/io.packagecloud.rabbitmq.gpg] https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ bionic main
deb-src [signed-by=/usr/share/keyrings/io.packagecloud.rabbitmq.gpg] https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ bionic main
EOF

## Update package indices
sudo apt-get update -y

## Install Erlang packages
sudo apt-get install -y erlang-base \
                        erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets \
                        erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key \
                        erlang-runtime-tools erlang-snmp erlang-ssl \
                        erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl

## Install rabbitmq-server and its dependencies
sudo apt-get install rabbitmq-server -y --fix-missing

Enable apt HTTPS Transport

In order for apt to be able to download RabbitMQ and Erlang packages from services such as PackageCloud, Cloudsmith.io or Launchpad, the apt-transport-https package must be installed:

sudo apt-get install apt-transport-https

Add Repository Signing Key

In order for apt to use the repository, RabbitMQ signing key must be available to the system for validation.

## Team RabbitMQ's main signing key
curl -1sLf "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/com.rabbitmq.team.gpg > /dev/null
## Launchpad PPA that provides modern Erlang releases
curl -1sLf "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xf77f1eda57ebb1cc" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg > /dev/null
## PackageCloud RabbitMQ repository
curl -1sLf "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/io.packagecloud.rabbitmq.gpg > /dev/null

See the guide on signatures to learn more.

Add a Source List File

As with all 3rd party apt repositories, a file describing the RabbitMQ and Erlang package repositories must be placed under the /etc/apt/sources.list.d/ directory. /etc/apt/sources.list.d/rabbitmq.list is the recommended location.

The file should have a source (repository) definition line that uses the following pattern:

# Source repository definition example.

## Provides modern Erlang/OTP releases
##
## "bionic" as distribution name should work for any reasonably recent Ubuntu or Debian release.
## See the release to distribution mapping table in RabbitMQ doc guides to learn more.
deb [signed-by=/usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg] http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu bionic main
deb-src [signed-by=/usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg] http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu bionic main

## Provides RabbitMQ
##
## "bionic" as distribution name should work for any reasonably recent Ubuntu or Debian release.
## See the release to distribution mapping table in RabbitMQ doc guides to learn more.
deb [signed-by=/usr/share/keyrings/io.packagecloud.rabbitmq.gpg] https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ bionic main
deb-src [signed-by=/usr/share/keyrings/io.packagecloud.rabbitmq.gpg] https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ bionic 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 often matches the Debian or Ubuntu release used:

  • focal for Ubuntu 20.04
  • bionic for Ubuntu 18.04
  • buster for Debian Buster

However, not all distributions are covered (indexed). But there are good news: since the package indexed for these distributions is identical, any reasonably recent distribution name would suffice in practice. For example, users of Debian Buster or Debian Bullseye can both use buster for distribution name.

Below is a table of OS release and distribution names that should be used with the RabbitMQ apt repository on PackageCloud.

Release Distribution

Ubuntu 20.04 focal

Ubuntu 18.04 bionic

Debian Buster buster

Debian Bullseye buster

Debian Sid buster

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

sudo tee /etc/apt/sources.list.d/rabbitmq.list <<EOF
## Provides modern Erlang/OTP releases
##
## "bionic" as distribution name should work for any reasonably recent Ubuntu or Debian release.
## See the release to distribution mapping table in RabbitMQ doc guides to learn more.
deb [signed-by=/usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg] http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu bionic main
deb-src [signed-by=/usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg] http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu bionic main

## Provides RabbitMQ
##
## Replace $distribution with the name of the Ubuntu release used.
## On Debian, "deb/ubuntu" should be replaced with "deb/debian"
deb [signed-by=/usr/share/keyrings/io.packagecloud.rabbitmq.gpg] https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ $distribution main
deb-src [signed-by=/usr/share/keyrings/io.packagecloud.rabbitmq.gpg] https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ $distribution main
EOF

where $distribution is the name of the Debian or Ubuntu distribution used (see the table above).

So, for example, on Debian Buster it would be

sudo tee /etc/apt/sources.list.d/rabbitmq.list <<EOF
## Provides modern Erlang/OTP releases
##
## "bionic" as distribution name should work for any reasonably recent Ubuntu or Debian release.
deb [signed-by=/usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg] http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu bionic main
deb-src [signed-by=/usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg] http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu bionic main

## Provides RabbitMQ
##
deb [signed-by=/usr/share/keyrings/io.packagecloud.rabbitmq.gpg] https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ buster main
deb-src [signed-by=/usr/share/keyrings/io.packagecloud.rabbitmq.gpg] https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ buster main
EOF

Install Packages

After updating the list of apt sources it is necessary to run apt-get update:

sudo apt-get update -y

Then install the package with

## Install Erlang packages
sudo apt-get install -y erlang-base \
                        erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets \
                        erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key \
                        erlang-runtime-tools erlang-snmp erlang-ssl \
                        erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl

## Install rabbitmq-server and its dependencies
sudo apt-get install rabbitmq-server -y --fix-missing

Using RabbitMQ Apt Repositories on Cloudsmith

Team RabbitMQ maintains two apt repositories on Cloudsmith, a package hosting service. They provide packages for most recent RabbitMQ and modern Erlang releases.

Cloudsmith provides repository setup instructions that include convenient one-liners:

Please always inspect scripts that are downloaded from the Internet and executed via a privileged shell!

This guide will focus on a more traditional and explicit way of setting up additional apt repositories and installing packages.

All steps covered below are mandatory unless otherwise specified.

Cloudsmith Quick Start Script

Below is shell snippet that performs those steps. They are documented in more detail below.

#!/usr/bin/sh

sudo apt-get install curl gnupg apt-transport-https -y

## Team RabbitMQ's main signing key
curl -1sLf "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/com.rabbitmq.team.gpg > /dev/null
## Cloudsmith: modern Erlang repository
curl -1sLf https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/io.cloudsmith.rabbitmq.E495BB49CC4BBE5B.gpg > /dev/null
## Cloudsmith: RabbitMQ repository
curl -1sLf https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/io.cloudsmith.rabbitmq.9F4587F226208342.gpg > /dev/null

## Add apt repositories maintained by Team RabbitMQ
sudo tee /etc/apt/sources.list.d/rabbitmq.list <<EOF
## Provides modern Erlang/OTP releases
##
deb [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.E495BB49CC4BBE5B.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/ubuntu bionic main
deb-src [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.E495BB49CC4BBE5B.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/ubuntu bionic main

## Provides RabbitMQ
##
deb [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.9F4587F226208342.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/deb/ubuntu bionic main
deb-src [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.9F4587F226208342.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/deb/ubuntu bionic main
EOF

## Update package indices
sudo apt-get update -y

## Install Erlang packages
sudo apt-get install -y erlang-base \
                        erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets \
                        erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key \
                        erlang-runtime-tools erlang-snmp erlang-ssl \
                        erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl

## Install rabbitmq-server and its dependencies
sudo apt-get install rabbitmq-server -y --fix-missing

All steps covered below are mandatory unless otherwise specified.

Install Essential Dependencies

sudo apt-get update -y

sudo apt-get install curl gnupg -y

Enable apt HTTPS Transport

In order for apt to be able to download RabbitMQ and Erlang packages from services such as PackageCloud, Cloudsmith.io or Launchpad, the apt-transport-https package must be installed:

sudo apt-get install apt-transport-https

Add Repository Signing Keys

Cloudsmith signs distributed packages using their own GPG keys, one per repository.

In order to use the repositories, their signing keys must be added to the system. This will enable apt to trust packages signed by that key.

sudo apt-get install curl gnupg apt-transport-https -y

## Team RabbitMQ's main signing key
curl -1sLf "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/com.rabbitmq.team.gpg > /dev/null
## Cloudsmith: modern Erlang repository
curl -1sLf https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/io.cloudsmith.rabbitmq.E495BB49CC4BBE5B.gpg > /dev/null
## Cloudsmith: RabbitMQ repository
curl -1sLf https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/io.cloudsmith.rabbitmq.9F4587F226208342.gpg > /dev/null

See the guide on signatures to learn more.

Add a Source List File

As with all 3rd party apt repositories, a file describing the RabbitMQ and Erlang package repositories must be placed under the /etc/apt/sources.list.d/ directory. /etc/apt/sources.list.d/rabbitmq.list is the recommended location.

The file should have a source (repository) definition line that uses the following pattern:

## Provides modern Erlang/OTP releases
##
## Replace $distribution with the name of the Ubuntu release used.
## On Debian, "deb/ubuntu" should be replaced with "deb/debian"
deb [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.E495BB49CC4BBE5B.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/ubuntu $distribution main
deb-src [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.E495BB49CC4BBE5B.gpg]  https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/ubuntu $distribution main

## Provides RabbitMQ
##
## Replace $distribution with the name of the Ubuntu release used.
## On Debian, "deb/ubuntu" should be replaced with "deb/debian"
deb [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.9F4587F226208342.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/deb/ubuntu $distribution main
deb-src [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.9F4587F226208342.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/deb/ubuntu $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 often matches the Debian or Ubuntu release used:

  • focal for Ubuntu 20.04
  • bionic for Ubuntu 18.04
  • buster for Debian Buster

However, not all distributions are covered (indexed). But there are good news: since the package indexed for these distributions is identical, any reasonably recent distribution name would suffice in practice. For example, users of Debian Buster or Debian Bullseye can both use buster for distribution name.

Below is a table of OS release and distribution names that should be used with the RabbitMQ apt repository on PackageCloud.

Release Distribution

Ubuntu 20.04 focal

Ubuntu 18.04 bionic

Debian Buster buster

Debian Bullseye buster

Debian Sid buster

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

sudo tee /etc/apt/sources.list.d/rabbitmq.list <<EOF
## Provides modern Erlang/OTP releases
##
## Replace $distribution with the name of the Ubuntu release used.
## On Debian, "deb/ubuntu" should be replaced with "deb/debian"
deb [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.E495BB49CC4BBE5B.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/ubuntu $distribution main
deb-src [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.E495BB49CC4BBE5B.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/ubuntu $distribution main

## Provides RabbitMQ
##
## Replace $distribution with the name of the Ubuntu release used.
## On Debian, "deb/ubuntu" should be replaced with "deb/debian"
deb [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.9F4587F226208342.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/deb/ubuntu $distribution main
deb-src [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.9F4587F226208342.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/deb/ubuntu $distribution main
EOF

where $distribution is the name of the Debian or Ubuntu distribution used (see the table above).

For example, on Debian Buster it would be

sudo tee /etc/apt/sources.list.d/rabbitmq.list <<EOF
## Provides modern Erlang/OTP releases
##
deb [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.E495BB49CC4BBE5B.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/debian buster main
deb-src [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.E495BB49CC4BBE5B.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/debian buster main

## Provides RabbitMQ
##
deb [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.9F4587F226208342.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/deb/debian buster main
deb-src [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.9F4587F226208342.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/deb/debian buster main
EOF

Install Packages

After updating the list of apt sources it is necessary to run apt-get update:

sudo apt-get update -y

Then install the package with

## Install Erlang packages
sudo apt-get install -y erlang-base \
                        erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets \
                        erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key \
                        erlang-runtime-tools erlang-snmp erlang-ssl \
                        erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl

## Install rabbitmq-server and its dependencies
sudo apt-get install rabbitmq-server -y --fix-missing

Debian Package Version and Repository Pinning

Version pinning is an optional step. If not used, apt will install the most recent version available.

When the same package (e.g. erlang-base) 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 feature 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 -y

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

# /etc/apt/preferences.d/erlang
Package: erlang*
Pin: origin dl.cloudsmith.io
Pin-Priority: 1000

The following is similar to the example above but prefers Launchpad:

# /etc/apt/preferences.d/erlang
Package: erlang*
Pin: origin ppa.launchpad.net
Pin-Priority: 1000

Effective package pinning policy can be verified with

sudo apt-cache policy

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

# /etc/apt/preferences.d/erlang
Package: erlang*
Pin: version 1:23.3
Pin-Priority: 1000

The following preference file example will pin rabbitmq-server package to 3.9.11 (assuming package epoch for the package is 1):

# /etc/apt/preferences.d/rabbitmq
Package: rabbitmq-server
Pin: version 1:3.9.11
Pin-Priority: 1000

In the example below, the esl-erlang package is pinned to 23.3.1 (assuming package epoch for the package is 1):

# /etc/apt/preferences.d/erlang
Package: esl-erlang
Pin: version 1:23.3.1
Pin-Priority: 1000

Manual Installation with Dpkg

In some cases it may be easier to download the package directly from GitHub and install it manually using sudo dpkg -i. Below is a download link.

Description Download Signature

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

When installing manually with dpkg, it is necessary to install package dependencies first. dpkg, unlike apt, does not resolve or manage dependencies.

Here's an example that does that, installs wget, downloads the RabbitMQ package and installs it:

# sync package metadata
sudo apt-get update
# install dependencies manually
sudo apt-get -y install socat logrotate init-system-helpers adduser

# download the package
sudo apt-get -y install wget
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.9.11/rabbitmq-server_3.9.11-1_all.deb

# install the package with dpkg
sudo dpkg -i rabbitmq-server_3.9.11-1_all.deb

rm rabbitmq-server_3.9.11-1_all.deb

Installation via apt repositories 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.

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.

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:

systemctl start rabbitmq-server

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 node is set up to run as system user rabbitmq. If location of the node database or the logs is changed, the files and directories must be owned by this user.

Port Access

RabbitMQ nodes bind to ports (open server TCP sockets) in order to accept client and CLI tool connections. Other processes and tools such as SELinux may prevent RabbitMQ from binding to a port. When that happens, the node will fail to start.

CLI tools, client libraries and RabbitMQ nodes also open connections (client TCP sockets). Firewalls can prevent nodes and CLI tools from communicating with each other. Make sure the following ports are accessible:

  • 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)
  • 15692: Prometheus metrics (only if the Prometheus 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 and delete 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 (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 many 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, to set the max open file handle limit (nofile) to 64000:

[Service]
LimitNOFILE=64000

See systemd documentation to learn about the supported limits and other directives.

With Docker

To configure kernel limits for Docker contains, use the "default-ulimits" key in Docker daemon configuration file. The file has to be installed on Docker hosts at /etc/docker/daemon.json:

{
  "default-ulimits": {
    "nofile": {
      "Name": "nofile",
      "Hard": 64000,
      "Soft": 64000
    }
  }
}

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.

Managing the Service

To start and stop the server, use the systemctl tool. The service name is rabbitmq-server:

# stop the local node
sudo systemctl stop rabbitmq-server

# start it back
sudo systemctl start rabbitmq-server

systemctl status rabbitmq-server will report service status as observed by systemd (or similar service manager):

# check on service status as observed by service manager
sudo systemctl status rabbitmq-server

It will produce output similar to this:

Redirecting to /bin/systemctl status rabbitmq-server.service
● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/rabbitmq-server.service.d
           └─limits.conf
   Active: active (running) since Wed 2021-05-07 10:21:32 UTC; 25s ago
 Main PID: 957 (beam.smp)
   Status: "Initialized"
   CGroup: /system.slice/rabbitmq-server.service
           ├─ 957 /usr/lib/erlang/erts-10.2/bin/beam.smp -W w -A 64 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -K true -- -root /usr/lib/erlang -progname erl -- -home /var/lib/rabbitmq -- ...
           ├─1411 /usr/lib/erlang/erts-10.2/bin/epmd -daemon
           ├─1605 erl_child_setup 400000
           ├─2860 inet_gethost 4
           └─2861 inet_gethost 4

Dec 26 10:21:30 localhost.localdomain rabbitmq-server[957]: ##  ##
Dec 26 10:21:30 localhost.localdomain rabbitmq-server[957]: ##  ##      RabbitMQ 3.8.17. Copyright (c) 2007-2021 VMware, Inc. or its affiliates.
Dec 26 10:21:30 localhost.localdomain rabbitmq-server[957]: ##########  Licensed under the MPL 2.0. Website: https://www.rabbitmq.com/
Dec 26 10:21:30 localhost.localdomain rabbitmq-server[957]: ######  ##
Dec 26 10:21:30 localhost.localdomain rabbitmq-server[957]: ##########  Logs: /var/log/rabbitmq/[email protected]
Dec 26 10:21:30 localhost.localdomain rabbitmq-server[957]: /var/log/rabbitmq/rabbit@localhost_upgrade.log
Dec 26 10:21:30 localhost.localdomain rabbitmq-server[957]: Starting broker...
Dec 26 10:21:32 localhost.localdomain rabbitmq-server[957]: systemd unit for activation check: "rabbitmq-server.service"
Dec 26 10:21:32 localhost.localdomain systemd[1]: Started RabbitMQ broker.
Dec 26 10:21:32 localhost.localdomain rabbitmq-server[957]: completed with 6 plugins.

rabbitmqctl, rabbitmq-diagnostics, and other CLI tools will be available in PATH and can be invoked by a sudo-enabled user:

# checks if the local node is running and CLI tools can successfully authenticate with it
sudo rabbitmq-diagnostics ping

# prints enabled components (applications), TCP listeners, memory usage breakdown, alarms
# and so on
sudo rabbitmq-diagnostics status

# prints cluster membership information
sudo rabbitmq-diagnostics cluster_status

# prints effective node configuration
sudo rabbitmq-diagnostics environment

All rabbitmqctl commands will report an error if no node is running. See the CLI tools and Monitoring guides to learn more.

Log Files and Management

Server logs can be found under the configurable directory, which usually defaults to /var/log/rabbitmq when RabbitMQ is installed via a Linux package manager.

RABBITMQ_LOG_BASE can be used to override log directory location.

Assuming a systemd-based distribution, system service logs can be inspected using

journalctl --system

which requires superuser privileges. Its output can be filtered to narrow it down to RabbitMQ-specific entries:

sudo journalctl --system | grep rabbitmq

The output will look similar to this:

Dec 26 11:03:04 localhost rabbitmq-server[968]: ##  ##
Dec 26 11:03:04 localhost rabbitmq-server[968]: ##  ##      RabbitMQ 3.8.17. Copyright (c) 2007-2021 VMware, Inc. or its affiliates.
Dec 26 11:03:04 localhost rabbitmq-server[968]: ##########  Licensed under the MPL 2.0. Website: https://www.rabbitmq.com/
Dec 26 11:03:04 localhost rabbitmq-server[968]: ######  ##
Dec 26 11:03:04 localhost rabbitmq-server[968]: ##########  Logs: /var/log/rabbitmq/[email protected]
Dec 26 11:03:04 localhost rabbitmq-server[968]: /var/log/rabbitmq/rabbit@localhost_upgrade.log
Dec 26 11:03:04 localhost rabbitmq-server[968]: Starting broker...
Dec 26 11:03:05 localhost rabbitmq-server[968]: systemd unit for activation check: "rabbitmq-server.service"
Dec 26 11:03:06 localhost rabbitmq-server[968]: completed with 6 plugins.

Log Rotation

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

logrotate is the recommended way of log file rotation and compression. By default, the package will set up logrotate to run weekly on files located in default /var/log/rabbitmq directory. Rotation configuration can be found in /etc/logrotate.d/rabbitmq-server.

Install Erlang from an Apt Repository (PPA) on Launchpad

This additional section covers installation of modern Erlang packages from Launchpad. To install modern Erlang and RabbitMQ, please refer to the sections above:

Modern Erlang on Debian

Standard Debian and Ubuntu repositories tend to provide outdated versions of Erlang/OTP. Team RabbitMQ maintains an apt repository that includes packages of latest Erlang/OTP releases on Launchpad.

RabbitMQ core team focus around package is on the current and prior release of Debian-based distributions, i.e. inline with distribution EOL policy.

The repository currently supports the following Ubuntu distributions:

  • Ubuntu 20.04 (Focal)
  • Ubuntu 18.04 (Bionic)

The following Debian releases can currently use the same apt repository:

  • Debian 10 (Buster)
  • Debian 11 (Bullseye)

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

In order to use the repository, it is necessary to

  • Install prerequisites needed to download signing keys and packages over HTTPS
  • Add repository signing key to your system. apt will verify package signatures during installation.
  • Add a source list file for the repository
  • Update package metadata
  • Install Erlang packages required by RabbitMQ

Install Essential Dependencies

sudo apt-get update -y

sudo apt-get install curl gnupg -y

Add Repository Signing Key

In order to use the repository, add RabbitMQ signing key to the system. This will enable apt to trust packages signed by that key.

# primary RabbitMQ signing key
curl -1sLf "https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/com.github.rabbitmq.signing.gpg > /dev/null

# Launchpad PPA signing key for apt
curl -1sLf "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xf77f1eda57ebb1cc" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg > /dev/null

See the guide on signatures to learn more.

Enable apt HTTPS Transport

In order for apt to be able to download RabbitMQ and Erlang packages from services such as PackageCloud, Cloudsmith.io or Launchpad, the apt-transport-https package must be installed:

sudo apt-get install apt-transport-https

Add a 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/erlang.list is the recommended location.

The file should have a source (repository) definition line that uses the following pattern:

# This Launchpad PPA repository provides Erlang packages produced by the RabbitMQ team
#
# Replace $distribution with the name of the Ubuntu release used. On Debian,
# use "bionic"
deb [signed-by=/usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg] http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu $distribution main
deb-src [signed-by=/usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg] http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu $distribution main

The next section discusses what distribution values are supported by the Launchpad PPA.

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 typically matches the Debian or Ubuntu release used but only a handful of distributions are supported (indexed) by the Erlang Debian packages maintained by Team RabbitMQ:

  • focal for Ubuntu 20.04
  • bionic for Ubuntu 18.04
  • bionic for Debian Buster and later versions

However, not all distributions are covered (indexed). But there are good news: since the package indexed for these distributions is identical, any reasonably recent distribution name would suffice in practice. For example, users of Debian Buster, Debian Sid, Ubuntu Disco and Ubuntu Eoan can use both stretch and bionic for distribution name.

Below is a table of OS release and distribution names that should be used with the Launchpad repository.

Release Distribution Name

Ubuntu 20.04 focal

Ubuntu 18.04 bionic

Debian Buster bionic

Debian Bullseye bionic

Debian Sid bionic

Install Erlang Packages

After updating the list of apt sources it is necessary to run apt-get update:

sudo apt-get update -y

Then packages can be installed just like with the standard Debian repositories:

# This is recommended. Metapackages such as erlang and erlang-nox must only be used
# with apt version pinning. They do not pin their dependency versions.
sudo apt-get install -y erlang-base \
                        erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets \
                        erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key \
                        erlang-runtime-tools erlang-snmp erlang-ssl \
                        erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl

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.

Help Us Improve the Docs <3

If you'd like to contribute an improvement to the site, its source is available on GitHub. Simply fork the repository and submit a pull request. Thank you!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK