A fresh Ubuntu box, a directive to “put a broker on it,” and a backlog of teams waiting to stop talking through a shared database. This article is the RabbitMQ install we run in production: pinned Erlang from the Team RabbitMQ archive, signed apt repository, systemd unit with sane file-descriptor limits, the management plugin gated by a firewall, and a first user that is not guest. The objective is a broker that you can hand to an application team and forget about for six months.
How to verify
Before installing anything, confirm the box is clean and the kernel has the limits a broker actually needs.
ss -ltnp | grep -E ':(5672|15672|25672|4369)\b'
dpkg -l | grep -E 'rabbitmq|erlang'
ulimit -n
sysctl fs.file-max
cat /proc/$(pgrep -f beam.smp)/limits 2>/dev/null | grep "open files" || true
If anything is bound to 5672 or 15672, identify the process before you install. RabbitMQ wants at least 65k open files; the default of 1024 will collapse the broker around 5000 connections.
What’s happening
RabbitMQ is an Erlang application. The broker is a long-running BEAM virtual machine that holds queues, exchanges, bindings, and connection state in memory, with optional disk persistence via Mnesia. The Ubuntu archive ships RabbitMQ, but it lags upstream by 6 to 18 months and pins to whatever Erlang version was current when the Ubuntu release was cut. For a production broker you want the Team RabbitMQ apt repositories: one for the broker, one for a curated Erlang build that is known to work with that broker version.
The wire layout is fixed. Port 5672 is AMQP 0-9-1 plaintext, 5671 is AMQPS over TLS. Port 15672 is the management HTTP API and web UI, only exposed when the rabbitmq_management plugin is enabled. Port 25672 is the inter-node cluster protocol — never exposed to the internet. Port 4369 is epmd, the Erlang port mapper, used by rabbitmqctl and by clustering. Lock these down with the firewall, not just with bind addresses.
The procedure
-
Install prerequisites and the signing keys. Cloudsmith hosts the Team RabbitMQ debs; three keys go into a keyring directory:
sudo apt update sudo apt install -y curl gnupg apt-transport-https ca-certificates lsb-release curl -1sLf "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803BA42EF63278F6DA975BDBE7B392" \ | sudo gpg --dearmor -o /usr/share/keyrings/com.rabbitmq.team.gpg curl -1sLf "https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.E495BB49CC4BBE5B.key" \ | sudo gpg --dearmor -o /usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg curl -1sLf "https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.9F4587F226208342.key" \ | sudo gpg --dearmor -o /usr/share/keyrings/rabbitmq.9F4587F226208342.gpg -
Add the apt sources. Two files: one for Erlang, one for the broker. Substitute
$(lsb_release -cs)for the Ubuntu codename (noble,jammy, etc.):sudo tee /etc/apt/sources.list.d/rabbitmq.list >/dev/null <<EOF deb [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa1.rabbitmq.com/rabbitmq/rabbitmq-erlang/deb/ubuntu $(lsb_release -cs) main deb [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa1.rabbitmq.com/rabbitmq/rabbitmq-server/deb/ubuntu $(lsb_release -cs) main EOF sudo apt update -
Install Erlang and the broker, pinning the Erlang version. Without a pin, an
apt upgradesix months later silently jumps you to an Erlang the broker has not been tested against:sudo apt 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 sudo apt install -y rabbitmq-server sudo apt-mark hold erlang-base rabbitmq-server -
Raise the open-files limit. The shipped systemd unit reads
/etc/systemd/system/rabbitmq-server.service.d/overrides:sudo mkdir -p /etc/systemd/system/rabbitmq-server.service.d sudo tee /etc/systemd/system/rabbitmq-server.service.d/limits.conf >/dev/null <<'EOF' [Service] LimitNOFILE=65536 EOF sudo systemctl daemon-reload sudo systemctl restart rabbitmq-serverConfirm with
cat /proc/$(pgrep -f beam.smp)/limits | grep "open files"— the soft and hard limits should both be 65536. -
Enable the management plugin and the Prometheus endpoint. Plugins persist across restarts once enabled:
sudo rabbitmq-plugins enable rabbitmq_management rabbitmq_prometheus curl -sS http://localhost:15672/api/overview -u guest:guest | head -c 200 curl -sS http://localhost:15692/metrics | head -20 -
Replace the default
guestuser. Theguestaccount is restricted to localhost by default but is still an embarrassment in a production listing. Create an admin user, then deleteguest:sudo rabbitmqctl add_user admin "$(openssl rand -base64 24)" sudo rabbitmqctl set_user_tags admin administrator sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*" sudo rabbitmqctl delete_user guestSave the password to your secret store, not to a chat thread.
-
Lock the firewall. Only AMQP and management to known sources; cluster protocol bound to the management VLAN:
sudo ufw allow from 10.0.0.0/8 to any port 5672 proto tcp sudo ufw allow from 10.0.10.0/24 to any port 15672 proto tcp sudo ufw deny 25672 sudo ufw deny 4369 sudo ufw reload
Common pitfalls
- Installing the Ubuntu archive version (
apt install rabbitmq-serverwithout the Team repository) gets you a broker months behind upstream — a few CVE cycles late and missing the management API features your dashboards rely on. - Forgetting to pin Erlang causes silent broker upgrades; mismatched Erlang/RabbitMQ tuples have known incompatibilities. Always
apt-mark holdboth packages. - The default
vm_memory_high_watermarkis 0.4 (40% of RAM); on a 32 GB broker box with no other tenants this is wasteful — but raise it knowingly, not by accident. - The management UI password is plaintext in the
rabbitmqctl add_usercommand — clear your bash history afterward (history -dthe line). rabbitmq.confis read once at start; runtime changes viarabbitmqctl set_policypersist in Mnesia, but config-file changes need a restart. Mixing the two leads to confusion six months later about where a setting came from.
Stack Harbor stands up brokers as a baseline for clients with multi-service backends — installs scripted, Erlang/broker tuples pinned, management API behind a VPN, and queue-depth metrics flowing into the same observability stack as the rest of the platform. If your broker grew from a quick install on a developer box into a load-bearing piece of plumbing, this is the work covered by our Managed Operations practice.