// SSD VPS

How to Install and Configure RabbitMQ on a Linux VPS: Complete Guide — CLIQHOST

November 15, 2026 · by Alex M.

How to Install and Configure RabbitMQ on a Linux VPS: Complete Guide — CLIQHOST

RabbitMQ is one of the most popular open-source message brokers in the world. If you're building a web application that needs asynchronous task processing, sending notifications, managing job queues, or communication between microservices, RabbitMQ is the right tool. In this complete guide, you'll learn how to install, configure, and secure RabbitMQ on a Linux SSD VPS — from scratch, step by step.

What is RabbitMQ and Why Do You Need It?

RabbitMQ implements the AMQP (Advanced Message Queuing Protocol) and acts as an intermediary between message producers and consumers. Instead of two services communicating directly, they exchange messages through a central broker — RabbitMQ.

Common use cases:

  • Asynchronous email sending (e.g., order confirmations)
  • Background image and file processing
  • Communication between microservices
  • Distributing tasks across multiple workers
  • Centralized logging and event sourcing

For all these scenarios, you need a stable and fast server. A CLIQHOST NVMe VPS provides excellent I/O for message persistence on disk, low latency, and dedicated resources — exactly what RabbitMQ needs in production.

Prerequisites

Before you begin, make sure you have:

  • A VPS running Ubuntu 22.04 LTS or Debian 12
  • Root or sudo access
  • An active SSH connection
  • At least 1 GB RAM (2 GB recommended for production)
  • Ports 5672 and 15672 available

If you don't have a server yet, you can quickly order a SSD VPS in Moldova with instant deployment.

Step 1: Update the System and Install Erlang

RabbitMQ is written in Erlang, so the first step is installing the Erlang runtime. We use the official RabbitMQ team repository for compatible versions.

sudo apt update && sudo apt upgrade -y
sudo apt install -y curl gnupg apt-transport-https

Add the GPG keys and necessary repositories:

# GPG key for Erlang Solutions
curl -fsSL https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc \
  | sudo gpg --dearmor -o /usr/share/keyrings/erlang.gpg

echo "deb [signed-by=/usr/share/keyrings/erlang.gpg] https://packages.erlang-solutions.com/ubuntu jammy contrib" \
  | sudo tee /etc/apt/sources.list.d/erlang.list

sudo apt update
sudo apt install -y erlang

Verify the installation:

erl -version
# Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 14.x

Step 2: Install RabbitMQ

Add the official RabbitMQ repository:

# RabbitMQ GPG key
curl -fsSL https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey \
  | sudo gpg --dearmor -o /usr/share/keyrings/rabbitmq.gpg

# RabbitMQ repository for Ubuntu 22.04
echo "deb [signed-by=/usr/share/keyrings/rabbitmq.gpg] https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ jammy main" \
  | sudo tee /etc/apt/sources.list.d/rabbitmq.list

sudo apt update
sudo apt install -y rabbitmq-server

Start the service and enable it at boot:

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

You should see active (running) in the output.

Step 3: Enable the Management Plugin (Web Interface)

RabbitMQ comes with an excellent management plugin that provides a web interface for monitoring and administration:

sudo rabbitmq-plugins enable rabbitmq_management
sudo systemctl restart rabbitmq-server

The web interface runs on port 15672. You can access http://SERVER-IP:15672 from your browser.

Security note: Do not expose port 15672 publicly without strong authentication. We recommend using a firewall (UFW or iptables) to restrict access.

Step 4: Configure Users and Permissions

The default guest user only works on localhost. For remote access, you need to create a dedicated user:

# Create a new user
sudo rabbitmqctl add_user admin SecurePassword123!

# Grant administrator rights
sudo rabbitmqctl set_user_tags admin administrator

# Grant full permissions on the default virtual host
sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"

Check the user list:

sudo rabbitmqctl list_users
# Listing users ...
# admin   [administrator]
# guest   []

In production, it's recommended to delete the guest user:

sudo rabbitmqctl delete_user guest

For applications running on a CLIQHOST managed dedicated server, proper RabbitMQ user management is essential for security.

Step 5: Configuring Virtual Hosts

Virtual Hosts (vhosts) in RabbitMQ are similar to virtual hosts in Apache — they provide logical isolation between different applications running on the same broker.

# Create a vhost for your application
sudo rabbitmqctl add_vhost myapp_production

# Give admin user access to the new vhost
sudo rabbitmqctl set_permissions -p myapp_production admin ".*" ".*" ".*"

# Create a dedicated application user
sudo rabbitmqctl add_user myapp_user AppPassword456!
sudo rabbitmqctl set_permissions -p myapp_production myapp_user ".*" ".*" ".*"

# List existing vhosts
sudo rabbitmqctl list_vhosts

This separation is critical when running multiple projects on the same VPS, as it prevents conflicts between queues and exchanges.

Step 6: Configuring the rabbitmq.conf File

The main configuration file is located at /etc/rabbitmq/rabbitmq.conf. Create it if it doesn't exist:

sudo nano /etc/rabbitmq/rabbitmq.conf

Add essential settings:

# Listening interface
listeners.tcp.default = 5672

# Management plugin
management.listener.port = 15672
management.listener.ip = 127.0.0.1

# Memory limit (40% of available RAM)
vm_memory_high_watermark.relative = 0.4

# Disk limit (minimum 1 GB free)
disk_free_limit.absolute = 1GB

# Heartbeat interval (seconds)
heartbeat = 60

# Log level
log.console.level = info

Restart the service after changes:

sudo systemctl restart rabbitmq-server

Step 7: Configuring the Firewall

Allow the necessary ports through UFW:

# AMQP port for clients
sudo ufw allow 5672/tcp comment 'RabbitMQ AMQP'

# Management port — ONLY from your admin IP
sudo ufw allow from 1.2.3.4 to any port 15672 comment 'RabbitMQ Management'

# Clustering port (if using clusters)
sudo ufw allow 25672/tcp comment 'RabbitMQ Clustering'

sudo ufw reload
sudo ufw status

Replace 1.2.3.4 with your real IP. This rule ensures the management interface is not publicly accessible.

Step 8: Testing the Connection with a Python Client

Install the pika library (Python client for RabbitMQ):

pip3 install pika

Test script — producer (sends messages):

# producer.py
import pika

credentials = pika.PlainCredentials('myapp_user', 'AppPassword456!')
params = pika.ConnectionParameters(
    host='localhost',
    virtual_host='myapp_production',
    credentials=credentials
)

connection = pika.BlockingConnection(params)
channel = connection.channel()

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

channel.basic_publish(
    exchange='',
    routing_key='tasks',
    body='Hello from RabbitMQ!',
    properties=pika.BasicProperties(delivery_mode=2)  # persistent message
)

print("Message sent successfully!")
connection.close()

Test script — consumer (receives messages):

# consumer.py
import pika

credentials = pika.PlainCredentials('myapp_user', 'AppPassword456!')
params = pika.ConnectionParameters(
    host='localhost',
    virtual_host='myapp_production',
    credentials=credentials
)

connection = pika.BlockingConnection(params)
channel = connection.channel()

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

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

channel.basic_qos(prefetch_count=1)
channel.basic_consume(queue='tasks', on_message_callback=callback)

print('Waiting for messages...')
channel.start_consuming()

Run the producer: python3 producer.py, then the consumer: python3 consumer.py.

Step 9: Configuring TLS/SSL for Secure Connections

For production, it's essential to encrypt AMQP traffic. You can use Let's Encrypt certificates.

Add TLS configuration to rabbitmq.conf:

# TLS listener
listeners.ssl.default = 5671

ssl_options.cacertfile = /etc/letsencrypt/live/yourdomain.com/chain.pem
ssl_options.certfile   = /etc/letsencrypt/live/yourdomain.com/cert.pem
ssl_options.keyfile    = /etc/letsencrypt/live/yourdomain.com/privkey.pem
ssl_options.verify     = verify_none
ssl_options.fail_if_no_peer_cert = false

If you need professional SSL certificates, CLIQHOST SSL certificates are a reliable choice, easy to integrate with any service.

Step 10: Monitoring and Useful Commands

rabbitmqctl commands give you complete visibility into the broker's state:

# General node status
sudo rabbitmqctl status

# List all queues and message counts
sudo rabbitmqctl list_queues name messages messages_ready messages_unacknowledged

# List active connections
sudo rabbitmqctl list_connections user peer_host peer_port state

# List exchanges
sudo rabbitmqctl list_exchanges

# Check memory usage
sudo rabbitmqctl report | grep memory

# Purge a queue
sudo rabbitmqctl purge_queue tasks -p myapp_production

For advanced monitoring, you can integrate RabbitMQ with Prometheus and Grafana — a popular combination on production servers. Check out the CLIQHOST blog for more guides on server monitoring and DevOps tooling.

Step 11: High Availability Policies

If you're running RabbitMQ in a cluster across multiple nodes (for example, on CLIQHOST dedicated servers), you can enable mirrored queues through policies:

# HA policy for all queues in the production vhost
sudo rabbitmqctl set_policy ha-all \
  -p myapp_production \
  "^" \
  '{"ha-mode":"all","ha-sync-mode":"automatic"}' \
  --priority 0 \
  --apply-to queues

# View active policies
sudo rabbitmqctl list_policies -p myapp_production

This configuration ensures messages are replicated across all cluster nodes, eliminating single points of failure.

Best Practices for RabbitMQ in Production

1. Use durable messages Declare queues with durable=True and publish messages with delivery_mode=2 to survive server restarts.

2. Set TTL and Dead Letter Exchanges Avoid accumulation of unprocessed messages:

# 24-hour TTL for queue messages
sudo rabbitmqctl set_policy ttl \
  -p myapp_production \
  "^tasks" \
  '{"message-ttl":86400000}'

3. Constantly monitor resources RabbitMQ enters blocking mode when memory or disk limits are reached. Check regularly:

sudo rabbitmqctl list_alarms

4. Back up broker definitions

sudo rabbitmqctl export_definitions /backup/rabbitmq-definitions.json

5. Choose a VPS with sufficient resources RabbitMQ with medium-to-high traffic requires at least 2 GB RAM and a fast SSD disk. A CLIQHOST NVMe VPS delivers optimal I/O performance for message persistence.

Troubleshooting Common Issues

RabbitMQ won't start:

sudo journalctl -u rabbitmq-server -n 50 --no-pager
# Check for port conflicts or Erlang issues

Connection refused on port 5672:

sudo ss -tlnp | grep 5672
sudo ufw status
# Check if the service is listening and the port is open

Out of memory — broker is blocking publishers: Increase the limit in rabbitmq.conf:

vm_memory_high_watermark.relative = 0.6

Or add more RAM by upgrading to a higher VPS plan.

Messages lost after restart: Make sure the queue is declared with durable=True and messages with delivery_mode=2.

Conclusion

RabbitMQ is an essential component in the architecture of modern applications — whether we're talking about microservices, asynchronous processing, or distributed systems. Proper installation and configuration on a Linux VPS, combined with solid security measures (separate users, TLS, firewall), turns the broker into a stable and reliable service.

To run RabbitMQ in production without worries, you need the right infrastructure. Explore the SSD VPS and NVMe VPS options available at CLIQHOST — servers in Moldova with real technical support and guaranteed uptime. Have questions about configuration or choosing the right plan? Contact the CLIQHOST team — we're here to help.

SHARE
// what clients say

What Our Clients Say

Real reviews from customers who trust CLIQHOST for performance, reliability and expert technical support.

★★★★★

"We moved our online shop from a foreign host and the difference is night and day — pages load instantly and support replies in minutes, in Romanian."

AM
Andrei M.
eCommerce owner · Chișinău
★★★★★

"Migrated 12 client sites to CLIQHOST. Free migration, zero downtime, and the cPanel setup is exactly what my team needed. Highly recommend."

EV
Elena V.
Web agency · Bălți
★★★★★

"Our NVMe VPS handles traffic spikes without a sweat. Full root, local datacenter, and billing in MDL — everything we wanted from a provider."

DC
Dmitri C.
SaaS founder · Chișinău