RabbitMQ Installation & Setup on a Dedicated Server

RabbitMQ is an open-source message broker that enables applications and services to communicate asynchronously through queues. Learn how to securely deploy and manage RabbitMQ on an Ubuntu 24.04 dedicated server.

Instead of requiring one application to wait for another application to finish processing a task, RabbitMQ can temporarily hold messages and deliver them to consumers when they are ready. RabbitMQ is commonly used for background jobs, microservices, event-driven applications, task processing, notifications, and distributed systems.

Running RabbitMQ on a dedicated server gives you direct control over CPU, memory, storage, networking, firewall rules, and system configuration. This tutorial explains how to install RabbitMQ on an Ubuntu 24.04 LTS dedicated server, configure users and virtual hosts, enable the Management Plugin, configure network access, enable TLS where required, and perform basic production checks.

Version note: This guide follows the current RabbitMQ 4.3 installation process documented for Ubuntu 24.04. RabbitMQ releases and supported Erlang versions can change, so check the official compatibility documentation when deploying a specific version.

What You Will Install

This tutorial uses:

  • Ubuntu 24.04 LTS
  • RabbitMQ 4.3.x
  • Erlang/OTP from Team RabbitMQ's repositories
  • RabbitMQ Management Plugin
  • UFW firewall
  • systemd

RabbitMQ recommends using Team RabbitMQ's APT repositories for modern RabbitMQ installations on Ubuntu instead of relying on the older RabbitMQ package supplied through the standard Ubuntu repositories.

1. Prerequisites

Before starting, make sure you have:

  • A dedicated server running Ubuntu 24.04 LTS
  • SSH access with sudo privileges
  • A static IP address
  • A hostname or domain name if required
  • Basic Linux command-line knowledge

For production deployments, do not expose RabbitMQ services to the entire Internet unless remote access is actually required. If the application and RabbitMQ run on the same server, RabbitMQ can be bound to localhost. If the application runs on another server, RabbitMQ can listen on an appropriate private network address and the firewall can restrict access to trusted application servers.

2. Connect to the Dedicated Server

Connect through SSH (Replace SERVER_IP with the server's IP address):

Bash
ssh your-user@SERVER_IP

Check the operating system:

Bash
cat /etc/os-release

Update the system:

Bash
sudo apt update
sudo apt upgrade -y

If the system requires a reboot, run sudo reboot and reconnect through SSH after the server restarts.

3. Install Required Repository Tools

Install the tools required to configure the RabbitMQ repositories:

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

RabbitMQ's official Ubuntu installation procedure uses these packages when configuring the Team RabbitMQ repositories.

4. Add the RabbitMQ Repository Signing Key

Import the Team RabbitMQ signing key:

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

APT uses the key to verify packages obtained from the RabbitMQ repositories. This command follows the current Team RabbitMQ Ubuntu installation procedure.

5. Add the RabbitMQ and Erlang Repositories

For Ubuntu 24.04, create the repository configuration:

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

## Modern 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

Update the package index:

Bash
sudo apt-get update -y

RabbitMQ's current installation documentation lists Ubuntu 24.04 (Noble) as supported and provides these Team RabbitMQ repositories.

Architecture note: The Team RabbitMQ Erlang repository shown above provides amd64 packages. For an ARM64 server, use a supported Erlang source such as the RabbitMQ-maintained Launchpad packages described in the official installation documentation.

6. Install Erlang/OTP

RabbitMQ requires Erlang/OTP. Install the Erlang packages:

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

Check the installed Erlang release:

Bash
erl -noshell -eval 'io:format("~p~n", [erlang:system_info(otp_release)]), halt().'

RabbitMQ's current installation documentation provides these Erlang package sets through the Team RabbitMQ repositories.

7. Install RabbitMQ Server

Install RabbitMQ:

Bash
sudo apt-get install rabbitmq-server -y --fix-missing

Check the service:

Bash
sudo systemctl status rabbitmq-server

RabbitMQ's Debian package starts the server as a system service and runs the broker as the non-privileged rabbitmq system user.

If necessary, start it manually, enable automatic startup, and verify:

Bash
sudo systemctl start rabbitmq-server
sudo systemctl enable rabbitmq-server
sudo systemctl is-active rabbitmq-server

8. Verify the RabbitMQ Installation

RabbitMQ provides command-line diagnostic tools with the package. Test the node and verify its active listeners:

Bash
sudo rabbitmq-diagnostics ping
sudo rabbitmq-diagnostics status
sudo rabbitmqctl version
sudo rabbitmq-diagnostics listeners

These commands are part of RabbitMQ's standard administration and diagnostic tooling.

9. Enable the RabbitMQ Management Plugin

RabbitMQ includes a web-based Management Plugin. Enable it:

Bash
sudo rabbitmq-plugins enable rabbitmq_management
sudo rabbitmq-plugins list -e

The Management Plugin can be enabled without restarting the RabbitMQ node. By default, the Management HTTP interface uses TCP port 15672. Open http://SERVER_IP:15672. Do not expose this interface publicly unless remote access is required and appropriate access controls are in place.

10. Create a Dedicated RabbitMQ Administrator

Create an administrative account and grant it privileges on the default virtual host:

Bash
sudo rabbitmqctl add_user rabbitadmin 'CHANGE_THIS_TO_A_STRONG_RANDOM_PASSWORD'
sudo rabbitmqctl set_user_tags rabbitadmin administrator
sudo rabbitmqctl set_permissions -p / rabbitadmin ".*" ".*" ".*"
sudo rabbitmqctl list_users

Use a strong, unique password rather than the example value.

11. Remove the Default Guest Account

RabbitMQ creates a guest user by default. After confirming that the dedicated administrator account works, remove the default account if it is not required:

Bash
sudo rabbitmqctl delete_user guest
sudo rabbitmqctl list_users

Your dedicated administrative account should remain.

12. Log in to RabbitMQ Management

Open http://SERVER_IP:15672. Use:

  • Username: rabbitadmin
  • Password: YOUR_PASSWORD

The Management UI provides information about Connections, Channels, Exchanges, Queues, Consumers, Message rates, Node status, and Resource usage. RabbitMQ documents port 15672 as the default Management UI and HTTP API port.

13. Create a Virtual Host

RabbitMQ virtual hosts provide logical separation within a broker. Create a virtual host for an application:

Bash
sudo rabbitmqctl add_vhost myapp
sudo rabbitmqctl list_vhosts

14. Create an Application User

Applications should use a separate account instead of the administrator account. Create the application user and grant access to the application's virtual host:

Bash
sudo rabbitmqctl add_user myappuser 'CHANGE_THIS_TO_ANOTHER_STRONG_PASSWORD'
sudo rabbitmqctl set_permissions -p myapp myappuser ".*" ".*" ".*"
sudo rabbitmqctl list_permissions -p myapp

For production applications, these regular-expression permissions should be narrowed when practical so the application receives only the access it requires.

15. Understand RabbitMQ's Main Components

RabbitMQ uses several core concepts. This allows applications to process work asynchronously:

  • Producer: A producer publishes messages (Application → Exchange).
  • Exchange: An exchange receives messages from producers and routes them to queues according to its type and bindings.
  • Queue: A queue holds messages until consumers receive them.
  • Consumer: A consumer receives and processes messages from a queue.

A simplified architecture is:

Producer
   |
   v
Exchange
   |
   +------> Queue A ------> Consumer A
   |
   +------> Queue B ------> Consumer B

16. Create a Test Queue

For this basic test, rabbitmqadmin is not required. The RabbitMQ installation provides rabbitmqctl. Create a durable classic queue:

Bash
sudo rabbitmqctl declare_queue -p myapp name=tasks durable=true
sudo rabbitmqctl list_queues -p myapp

You should see: tasks. RabbitMQ also provides rabbitmqadmin v2 as a separate HTTP API command-line tool, but it is unnecessary for this basic queue test.

17. Configure RabbitMQ Network Listeners

RabbitMQ's standard AMQP listener uses TCP port 5672. A common configuration is listeners.tcp.default = 5672. This specifies the listener port but does not restrict RabbitMQ to a particular network interface. RabbitMQ documents this default listener as binding to all available network interfaces.

If RabbitMQ should listen only on a particular interface, specify the address together with the port. Edit the configuration:

Bash
sudo nano /etc/rabbitmq/rabbitmq.conf

Listen only on localhost: Use this when the application and RabbitMQ are on the same server:

listeners.tcp.default = 127.0.0.1:5672


Listen on a private network interface: For example (Replace 10.0.0.5 with the server's actual private IP address):

listeners.tcp.default = 10.0.0.5:5672


RabbitMQ's configuration documentation supports listener settings using a port or an address/port combination. Restart RabbitMQ after changing the configuration and verify the listener:

Bash
sudo systemctl restart rabbitmq-server
sudo rabbitmq-diagnostics listeners

18. Configure the Management Interface

The Management Plugin has its own listener configuration. The default Management HTTP listener uses port 15672, and its interface can be configured with management.tcp.ip.

Conf
management.tcp.ip = 127.0.0.1
management.tcp.port = 15672

This keeps the Management interface accessible only from the local machine. If remote administrators need access through a private network (replace 10.0.0.5 appropriately):

Conf
management.tcp.ip = 10.0.0.5
management.tcp.port = 15672

Restart RabbitMQ and verify:

Bash
sudo systemctl restart rabbitmq-server
sudo rabbitmq-diagnostics listeners

For public-facing administration, prefer a controlled administrative network or another secure access mechanism rather than exposing the Management interface broadly.

19. Configure the Firewall

RabbitMQ uses different ports for different services. RabbitMQ documents these listeners and recommends controlling access to internal communication ports rather than exposing them unnecessarily.

Port Purpose
5672AMQP without TLS
5671AMQP with TLS
15672Management UI/API without TLS
15671Management UI/API with TLS
25672Inter-node and CLI communication

Configure UFW rules. Replace APPLICATION_SERVER_IP and ADMIN_IP with your trusted IP addresses:

Bash
sudo ufw allow OpenSSH

# Allow AMQP from a trusted application server
sudo ufw allow from APPLICATION_SERVER_IP to any port 5672 proto tcp

# Allow Management access from a trusted administrator
sudo ufw allow from ADMIN_IP to any port 15672 proto tcp

sudo ufw enable
sudo ufw status

Single-server deployment: If the application and RabbitMQ are on the same dedicated server and RabbitMQ is bound to listeners.tcp.default = 127.0.0.1:5672, there is normally no reason to expose port 5672 through the public firewall.

20. Configure TLS for AMQP

If applications connect to RabbitMQ across an untrusted network, use TLS rather than unencrypted AMQP. RabbitMQ supports AMQP over TLS using port 5671.

A TLS configuration requires a CA certificate, Server certificate, and Server private key. Create a protected directory:

sudo mkdir -p /etc/rabbitmq/tls


Place the required certificate files in this directory and ensure that the private key has appropriately restrictive permissions. A basic server-authenticated TLS configuration in rabbitmq.conf can use:

Conf
listeners.ssl.default = 5671

ssl_options.cacertfile = /etc/rabbitmq/tls/ca_certificate.pem
ssl_options.certfile = /etc/rabbitmq/tls/server_certificate.pem
ssl_options.keyfile = /etc/rabbitmq/tls/server_key.pem

ssl_options.verify = verify_peer
ssl_options.fail_if_no_peer_cert = false

With verify_peer, RabbitMQ verifies a client certificate when one is presented. Setting fail_if_no_peer_cert = false allows clients that do not present client certificates, which is suitable for TLS setups where the server authenticates clients through the normal RabbitMQ authentication mechanisms.

For mutual TLS, where every client must present a certificate, use ssl_options.fail_if_no_peer_cert = true. RabbitMQ recommends peer verification for production TLS deployments.

Restart RabbitMQ and verify the TLS listener is active:

Bash
sudo systemctl restart rabbitmq-server
sudo rabbitmq-diagnostics listeners

21. Configure HTTPS for the Management Interface

For remote administration, HTTPS is preferable to exposing the Management UI over plain HTTP. RabbitMQ supports the Management HTTPS listener on port 15671. A simplified configuration is:

Conf
management.ssl.port = 15671

management.ssl.cacertfile = /etc/rabbitmq/tls/ca_certificate.pem
management.ssl.certfile = /etc/rabbitmq/tls/server_certificate.pem
management.ssl.keyfile = /etc/rabbitmq/tls/server_key.pem

If the Management interface needs to bind to a particular address, configure the corresponding Management interface setting as documented by RabbitMQ.

Restart RabbitMQ and verify:

Bash
sudo systemctl restart rabbitmq-server
sudo rabbitmq-diagnostics listeners

Access the interface through: https://SERVER_IP:15671. For production environments, restrict access to trusted administrator networks whenever possible. RabbitMQ's Management documentation provides the HTTPS listener and certificate configuration details.

22. Check RabbitMQ Resource Usage

These commands are useful when investigating high memory usage, connection growth, or queue backlogs.

Bash
# Check the overall node
sudo rabbitmq-diagnostics status

# Inspect memory usage
sudo rabbitmq-diagnostics memory_breakdown

# List entities
sudo rabbitmqctl list_queues -p myapp
sudo rabbitmqctl list_connections
sudo rabbitmqctl list_channels

23. Monitor Queue Depth

A growing queue can indicate that producers are generating work faster than consumers can process it. Run:

Bash
sudo rabbitmqctl list_queues -p myapp name messages messages_ready messages_unacknowledged consumers

Important values include:

  • messages: messages currently associated with the queue
  • messages_ready: messages waiting to be delivered
  • messages_unacknowledged: delivered messages that have not yet been acknowledged
  • consumers: consumers currently connected to the queue

A consistently increasing messages_ready value can indicate that consumers cannot keep up with incoming work.

24. Check Service Startup

Verify that RabbitMQ is enabled to automatically start after the dedicated server reboots:

Bash
sudo systemctl is-enabled rabbitmq-server
# If required: sudo systemctl enable rabbitmq-server
sudo systemctl status rabbitmq-server

25. View RabbitMQ Logs

RabbitMQ's Ubuntu/Debian documentation provides systemd service management and log inspection guidance:

Bash
# Check recent service logs
sudo journalctl -u rabbitmq-server -n 100

# Follow logs in real time
sudo journalctl -u rabbitmq-server -f

26. Basic RabbitMQ Health Check

If these commands return the expected results, the RabbitMQ node is operational.

Bash
sudo rabbitmq-diagnostics ping
sudo rabbitmq-diagnostics status
sudo rabbitmq-diagnostics listeners
sudo rabbitmqctl list_users
sudo rabbitmqctl list_vhosts
sudo rabbitmqctl list_queues -p myapp

27. Dedicated Server Optimization

A dedicated server provides isolated CPU, memory, storage, and network resources, but RabbitMQ performance still depends on workload characteristics.

  • CPU: CPU usage can increase with high message rates, large numbers of connections, routing activity, many consumers, and application-side processing. Monitor CPU utilization before changing worker or connection counts.
  • Memory: RabbitMQ uses memory for queues, connections, message data, and internal broker structures. Monitor memory and queue growth instead of simply increasing RAM.
  • Storage: Durable messaging can generate significant disk I/O. Fast SSD or NVMe storage can be useful for workloads with substantial persistent message traffic.
  • Network: Network requirements depend on message size, message rate, number of producers/consumers, and replication or clustering architecture. Monitor network throughput to identify potential bottlenecks.

28. Production Security Checklist

Before using RabbitMQ in production, review the following:

  • Authentication: Use dedicated RabbitMQ users. Do not use the default guest account for production applications. Use strong, unique passwords. Separate administrative and application accounts.
  • Authorization: Use virtual hosts to separate applications. Grant only the permissions required by each application. Avoid giving application users administrator privileges.
  • Network: Expose only required ports. Restrict AMQP access to trusted application servers. Restrict Management UI access to trusted administrators. Do not publicly expose inter-node communication ports unnecessarily.
  • Encryption: Use TLS for AMQP connections crossing untrusted networks. Use HTTPS for remote Management UI access. Protect TLS private keys. Use peer verification for production TLS deployments.
  • Operating system: Keep Ubuntu updated. Keep RabbitMQ and Erlang within supported versions. Use a host firewall. Monitor logs and resource usage.

29. Common Troubleshooting

RabbitMQ Will Not Start

Investigate configuration errors, incompatible dependencies, port conflicts, and filesystem permissions:

Bash
sudo systemctl status rabbitmq-server
sudo journalctl -u rabbitmq-server -n 100
sudo rabbitmq-diagnostics status

Port 5672 Is Not Reachable

Check the listeners via sudo rabbitmq-diagnostics listeners and UFW status via sudo ufw status. If RabbitMQ is bound to a private IP, verify that the client is connecting to that address. If the application is on another server, verify that its source IP is allowed by the firewall.

Management UI Does Not Open

Check that the plugin is enabled via sudo rabbitmq-plugins list -e, check listeners, and check the firewall. If you configured management.tcp.ip = 127.0.0.1, the Management UI will not be directly accessible through the server's public IP. Use local access or an appropriate secure administration method.

RabbitMQ Uses Too Much Memory

Check sudo rabbitmq-diagnostics memory_breakdown then inspect queue sizes using sudo rabbitmqctl list_queues -p myapp. Look for queues with rapidly increasing message counts. Determine whether consumers are keeping up with producers before increasing server resources.

30. Useful RabbitMQ Commands

Bash
# Service Management
sudo systemctl status rabbitmq-server
sudo systemctl start rabbitmq-server
sudo systemctl stop rabbitmq-server
sudo systemctl restart rabbitmq-server
sudo systemctl enable rabbitmq-server

# Node Diagnostics & Health Checks
sudo rabbitmq-diagnostics status
sudo rabbitmq-diagnostics ping
sudo rabbitmq-diagnostics listeners

# List Resources
sudo rabbitmqctl list_users
sudo rabbitmqctl list_vhosts
sudo rabbitmqctl list_queues
sudo rabbitmqctl list_connections
sudo rabbitmqctl list_channels

# Plugins
sudo rabbitmq-plugins enable rabbitmq_management

Conclusion

RabbitMQ provides a reliable messaging layer that allows applications and services to communicate asynchronously. Installing it on a dedicated server gives you direct control over CPU, memory, storage, networking, and security configuration.

A production RabbitMQ deployment should go beyond simply installing the broker. Network listeners should be configured according to the application's architecture, unnecessary ports should remain inaccessible, application accounts should be separated from administrative accounts, and TLS should be used when messaging traffic crosses untrusted networks.

With RabbitMQ installed and configured correctly, a dedicated server can act as a centralized message broker for background jobs, microservices, event-driven applications, task queues, and other asynchronous workloads.

Deploy RabbitMQ on Bare-Metal Power

A production RabbitMQ deployment requires isolated CPU, memory, storage, and network resources. Dedicated servers provide the raw performance and direct control you need for high message rates and heavy inference workloads.

Looking for the perfect hardware for your event-driven applications? Explore Fit Servers for high-performance, cost-effective dedicated hosting solutions. We give you the raw power and dedicated bandwidth required to keep your asynchronous workloads fast and secure.

Configure your dedicated server today!