RabbitMQ Install on Linux

Linux is the most common operating system for running RabbitMQ in production. This guide covers installation on Ubuntu/Debian and CentOS/RHEL. RabbitMQ's official team maintains a script-based installation that handles all dependencies cleanly.

Prerequisites

  • Ubuntu 20.04 / 22.04 / 24.04 or Debian 11/12 (for the apt section)
  • CentOS 7/8 or RHEL 8/9 (for the yum/dnf section)
  • Root or sudo access
  • Active internet connection

Installing on Ubuntu or Debian

Method 1 – Using the Official RabbitMQ Script (Recommended)

The RabbitMQ team provides a shell script that adds the correct APT repositories, installs the matching Erlang version, and installs RabbitMQ in one go. This is the safest method because it avoids version mismatches between Erlang and RabbitMQ.

curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.deb.sh | sudo bash
sudo apt-get install -y rabbitmq-server

After this finishes, RabbitMQ starts as a system service automatically.

Method 2 – Manual APT Setup

First, add the Erlang repository from Team RabbitMQ:

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

curl -1sLf https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA | sudo gpg --dearmor -o /usr/share/keyrings/com.rabbitmq.team.gpg

echo "deb [signed-by=/usr/share/keyrings/com.rabbitmq.team.gpg] https://ppa1.novemberain.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/rabbitmq-erlang.list

echo "deb [signed-by=/usr/share/keyrings/com.rabbitmq.team.gpg] https://ppa1.novemberain.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/rabbitmq.list

sudo apt-get update -y
sudo apt-get install -y erlang-base rabbitmq-server

Installing on CentOS or RHEL

Use the packagecloud repository for CentOS and RHEL:

curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
sudo yum install -y rabbitmq-server

For RHEL 8 or newer, replace yum with dnf:

sudo dnf install -y rabbitmq-server

Starting and Enabling the Service

After installation, start RabbitMQ and configure it to start on every boot:

sudo systemctl start rabbitmq-server
sudo systemctl enable rabbitmq-server

Check that it is running:

sudo systemctl status rabbitmq-server

You should see active (running) in the output.

Enabling the Management Plugin

Enable the web-based management UI:

sudo rabbitmq-plugins enable rabbitmq_management

Restart RabbitMQ to apply the change:

sudo systemctl restart rabbitmq-server

The management UI is now available at http://localhost:15672 (or replace localhost with your server's IP address if accessing remotely).

Creating an Admin User

The default guest user only works from localhost. Create a new admin user for remote or production access:

sudo rabbitmqctl add_user admin StrongPassword123
sudo rabbitmqctl set_user_tags admin administrator
sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"

Replace StrongPassword123 with a secure password of your choice.

Firewall Configuration

If your server has a firewall, open the required ports:

Port 5672  – AMQP connections (producers and consumers)
Port 15672 – Management UI (browser)
Port 4369  – Erlang port mapper (needed for clustering)
Port 25672 – Inter-node communication (needed for clustering)

On Ubuntu with UFW:

sudo ufw allow 5672
sudo ufw allow 15672

On CentOS/RHEL with firewalld:

sudo firewall-cmd --permanent --add-port=5672/tcp
sudo firewall-cmd --permanent --add-port=15672/tcp
sudo firewall-cmd --reload

Viewing Logs

RabbitMQ logs are stored in /var/log/rabbitmq/. The main log file is named rabbit@hostname.log. Tail the log in real time to debug startup issues:

sudo tail -f /var/log/rabbitmq/rabbit@$(hostname).log

Important File Locations

/etc/rabbitmq/          – Configuration files
/var/lib/rabbitmq/      – Data and mnesia database
/var/log/rabbitmq/      – Log files
/usr/lib/rabbitmq/      – RabbitMQ binaries and plugins

Uninstalling RabbitMQ on Ubuntu

sudo apt-get remove --purge -y rabbitmq-server erlang*
sudo rm -rf /var/lib/rabbitmq /etc/rabbitmq /var/log/rabbitmq

Summary

Installing RabbitMQ on Linux is straightforward using the official packagecloud repositories. The key steps are: add the repository, install RabbitMQ and Erlang together, start the service with systemctl, enable the management plugin, and create an admin user. Opening the correct firewall ports ensures your applications can connect from any machine in your network.

Leave a Comment

Your email address will not be published. Required fields are marked *