How to Install RabbitMQ on Ubuntu: Step-by-Step

This guide will walk you through the complete process of installing the latest version of RabbitMQ on your Ubuntu server using the official repositories.

pterodactyl

Understanding the Basics

Ubuntu

What is RabbitMQ and Why Use It?

RabbitMQ is an open-source message broker software that acts as a secure middleman for your applications. It accepts, stores, and forwards messages between different parts of your software system. Think of it like a digital post office: when one application needs to send data to another, it drops the message off at RabbitMQ, which safely holds it and ensures it gets delivered to the right destination at the exact right time.

When running applications on dedicated servers, heavy background tasks can quickly slow down the user experience. RabbitMQ solves this by allowing your main web application to hand off time-consuming jobs like sending batch emails, processing large images, or generating heavy reports to background worker servers. This means your main web server stays fast and highly responsive to users, while other dedicated servers quietly handle the heavy computing work behind the scenes.

Using RabbitMQ on dedicated servers also makes your entire system much more reliable and easier to scale. If a worker server suddenly crashes or goes offline, RabbitMQ keeps the messages safe and will simply give the uncompleted task to another available server. As your application traffic grows, you can easily connect more dedicated servers to RabbitMQ to handle the increased load without having to rewrite any of your core application code.

Prerequisites

  • A dedicated server or virtual private server (VPS) running Ubuntu 24.04, 22.04, or 20.04.
  • A user account with sudo (administrator) privileges.
  • A stable internet connection to download the necessary repository packages.
  • Basic familiarity with navigating the Linux command-line terminal.

Step-by-Step Installation

1

Install Essential Dependencies

First, update your package list and install the tools required to securely download and add the repository keys.
BASH
sudo apt-get update -y
sudo apt-get install curl gnupg apt-transport-https -y
2

Add Team RabbitMQ's Signing Key

Download the official signing key so your Ubuntu system can verify and trust the packages from the RabbitMQ repository.
BASH
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
3

Add the Apt Repositories for Erlang and RabbitMQ

Create an Apt source list file for RabbitMQ.

Important Note on Ubuntu Versions: The code snippet below uses noble , which is the codename for Ubuntu 24.04. If you are installing on an older version, change noble to your specific version:

  • For Ubuntu 22.04, replace noble with jammy.
  • For Ubuntu 20.04, replace noble with focal.
BASH
sudo tee /etc/apt/sources.list.d/rabbitmq.list <<EOF
## Modern Erlang/OTP releases
##
deb [arch=amd64 signed-by=/usr/share/keyrings/com.rabbitmq.team.gpg] https://deb1.rabbitmq.com/rabbitmq-erlang/ubuntu/noble noble main
deb [arch=amd64 signed-by=/usr/share/keyrings/com.rabbitmq.team.gpg] https://deb2.rabbitmq.com/rabbitmq-erlang/ubuntu/noble noble main

## Latest RabbitMQ releases
##
deb [arch=amd64 signed-by=/usr/share/keyrings/com.rabbitmq.team.gpg] https://deb1.rabbitmq.com/rabbitmq-server/ubuntu/noble noble main
deb [arch=amd64 signed-by=/usr/share/keyrings/com.rabbitmq.team.gpg] https://deb2.rabbitmq.com/rabbitmq-server/ubuntu/noble noble main
EOF
4

Update Package Indices

Now that the new repositories are added, update your system's package list again to fetch the latest package metadata from Team RabbitMQ.
Bash
sudo apt-get update -y
5

Install Erlang Packages

RabbitMQ is built on top of the Erlang programming language, so you must install the Erlang environment first. The Team RabbitMQ repository provides an optimized version split into smaller packages to avoid bloated dependencies.
Bash
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
6

Install RabbitMQ Server

With Erlang installed, you can now install the actual RabbitMQ server package.
Bash
sudo apt-get install rabbitmq-server -y --fix-missing
7

Verify the Installation and Service Status

The RabbitMQ service is typically started automatically by your system upon installation. You can check its status and verify that the local node is running successfully.
Bash
# Check the systemd service status
sudo systemctl status rabbitmq-server

# Verify the local node is running and CLI tools can successfully authenticate
sudo rabbitmq-diagnostics ping

# Print the overall status of the RabbitMQ node
sudo rabbitmq-diagnostics status
8

Enable the Management UI Plugin (Optional but Recommended)

If you want to monitor and manage RabbitMQ from a simple web browser interface, enable the official management plugin.
Bash
sudo rabbitmq-plugins enable rabbitmq_management
(After running this command, you can access the User Interface via your web browser by navigating to http://localhost:15672 or http://<your-server-ip>:15672 ).

Discover CTCservers Dedicated Server Locations

CTCservers servers are available around the world, providing diverse options for hosting websites. Each region offers unique advantages, making it easier to choose a location that best suits your specific hosting needs.