RabbitMQ is a mature, battle-tested open-source message broker that implements the AMQP 0-9-1 protocol. It decouples application components by enabling asynchronous communication through exchanges, queues, and bindings. Producers publish messages to exchanges; exchanges route messages to queues based on routing rules (direct, topic, fanout, headers); consumers subscribe to queues and process messages independently of the producer. RabbitMQ provides message persistence, delivery acknowledgements, dead-letter queues, and a management UI out of the box. It is the standard choice for task queues, event pipelines, and microservice communication in enterprise environments. This guide covers installing RabbitMQ 3.13 on RHEL 9, configuring the management plugin, setting up users and vhosts, and testing with Python clients.

Prerequisites

  • RHEL 9 with sudo/root access
  • At least 2 GB RAM (4 GB recommended for production)

Step 1 — Install Erlang (RabbitMQ Runtime)

# Add the Erlang Solutions repo
curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | bash
dnf install -y erlang
erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell

Step 2 — Install RabbitMQ

curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | bash
dnf install -y rabbitmq-server
systemctl enable --now rabbitmq-server
systemctl status rabbitmq-server

Step 3 — Enable the Management UI

rabbitmq-plugins enable rabbitmq_management

# Management UI is now available at http://server-ip:15672
# Default guest/guest user is localhost-only — create a new admin user

Step 4 — Create Admin User and Vhost

# Create admin user
rabbitmqctl add_user admin 'RabbitAdminPass123!'
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"

# Create an application vhost for isolation
rabbitmqctl add_vhost myapp
rabbitmqctl add_user appuser 'AppUserPass123!'
rabbitmqctl set_permissions -p myapp appuser ".*" ".*" ".*"

# Remove guest remote access (security — keep guest as localhost-only)
# The default config already restricts guest to 127.0.0.1
rabbitmqctl list_users

Step 5 — Publish and Consume with Python

pip install pika
# producer.py — publish a task message
import pika

credentials = pika.PlainCredentials('appuser', 'AppUserPass123!')
params = pika.ConnectionParameters('localhost', 5672, 'myapp', credentials)
connection = pika.BlockingConnection(params)
channel = connection.channel()

channel.queue_declare(queue='tasks', durable=True)

channel.basic_publish(
    exchange='',
    routing_key='tasks',
    body='process_report:user_123',
    properties=pika.BasicProperties(delivery_mode=pika.DeliveryMode.Persistent)
)
print("Message sent")
connection.close()
# consumer.py — process task messages
import pika

def callback(ch, method, properties, body):
    print(f"Processing: {body.decode()}")
    ch.basic_ack(delivery_tag=method.delivery_tag)

credentials = pika.PlainCredentials('appuser', 'AppUserPass123!')
params = pika.ConnectionParameters('localhost', 5672, 'myapp', credentials)
connection = pika.BlockingConnection(params)
channel = connection.channel()

channel.queue_declare(queue='tasks', durable=True)
channel.basic_qos(prefetch_count=1)
channel.basic_consume(queue='tasks', on_message_callback=callback)
print("Waiting for messages...")
channel.start_consuming()

Step 6 — Open the Firewall for Remote Access

# AMQP port (application clients)
firewall-cmd --permanent --add-port=5672/tcp
# Management UI (restrict to admin IPs only)
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=10.0.0.0/8 port port=15672 protocol=tcp accept'
firewall-cmd --reload

Conclusion

RabbitMQ on RHEL 9 provides a reliable asynchronous messaging backbone for decoupled application architectures. Key production practices include: enabling message durability (durable=True on queues, delivery_mode=Persistent on messages), using separate vhosts per application for isolation, and monitoring the management UI for queue depth (high depth indicates consumers are falling behind producers). For high availability, configure a RabbitMQ cluster with mirrored queues or quorum queues.

Next steps: How to Install Apache Kafka on RHEL 9, How to Configure RabbitMQ Clustering on RHEL 9, and How to Install Redis on RHEL 9.