DEV Community

Cover image for Installing RabbitMQ on Ubuntu 26.04
Aashish Chaurasiya for Vultr

Posted on • Originally published at docs.vultr.com

Installing RabbitMQ on Ubuntu 26.04

RabbitMQ is an open-source message broker that enables distributed applications to communicate through message queues, decoupling producers and consumers across services. This guide installs RabbitMQ on Ubuntu 26.04, enables the management plugin, creates an admin user, and secures the web dashboard with Nginx and a Let's Encrypt certificate. By the end, you'll have RabbitMQ running with a secure management interface accessible over HTTPS.


Install RabbitMQ

RabbitMQ is available in Ubuntu 26.04's default APT repository.

1. Update the APT package index:

$ sudo apt update
Enter fullscreen mode Exit fullscreen mode

2. Install Erlang and RabbitMQ:

$ sudo apt install gnupg erlang rabbitmq-server -y
Enter fullscreen mode Exit fullscreen mode

What you just installed:

  • erlang: the runtime RabbitMQ is built on
  • rabbitmq-server: the message broker daemon

3. Verify the installed version:

$ rabbitmq-diagnostics --version
Enter fullscreen mode Exit fullscreen mode

Manage the RabbitMQ Service

Enable RabbitMQ to start automatically when the server boots.

1. Enable and start the service:

$ sudo systemctl enable rabbitmq-server
$ sudo systemctl start rabbitmq-server
Enter fullscreen mode Exit fullscreen mode

2. Check the service status:

$ sudo systemctl status rabbitmq-server
Enter fullscreen mode Exit fullscreen mode

3. Stop or restart the service when needed:

$ sudo systemctl stop rabbitmq-server
$ sudo systemctl restart rabbitmq-server
Enter fullscreen mode Exit fullscreen mode

Configure RabbitMQ

1. Enable the management plugin:

$ sudo rabbitmq-plugins enable rabbitmq_management
Enter fullscreen mode Exit fullscreen mode

2. Create an admin user:

$ sudo rabbitmqctl add_user example_admin strong_password
Enter fullscreen mode Exit fullscreen mode

3. Grant the user administrator permissions:

$ sudo rabbitmqctl set_user_tags example_admin administrator
Enter fullscreen mode Exit fullscreen mode

4. Set resource permissions for the default virtual host:

$ sudo rabbitmqctl set_permissions -p / example_admin ".*" ".*" ".*"
Enter fullscreen mode Exit fullscreen mode

The three permission patterns grant configure, write, and read access on all resources in the / virtual host.


Configure Firewall Rules

$ sudo ufw allow 80/tcp
$ sudo ufw allow 443/tcp
Enter fullscreen mode Exit fullscreen mode

Configure Nginx as a Reverse Proxy

The RabbitMQ management interface listens on port 15672. Proxy it through Nginx on port 80.

1. Install Nginx:

$ sudo apt install nginx -y
Enter fullscreen mode Exit fullscreen mode

2. Enable and start Nginx:

$ sudo systemctl enable nginx
$ sudo systemctl start nginx
Enter fullscreen mode Exit fullscreen mode

3. Create the reverse proxy configuration:

$ sudo nano /etc/nginx/sites-available/rabbitmq.example.com.conf
Enter fullscreen mode Exit fullscreen mode
server {
    listen 80;
    server_name rabbitmq.example.com;

    location / {
        proxy_pass http://localhost:15672;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
Enter fullscreen mode Exit fullscreen mode

4. Enable the site and reload Nginx:

$ sudo ln -s /etc/nginx/sites-available/rabbitmq.example.com.conf /etc/nginx/sites-enabled/
$ sudo nginx -t
$ sudo systemctl reload nginx
Enter fullscreen mode Exit fullscreen mode

Secure with Let's Encrypt SSL

1. Install Certbot with the Nginx plugin:

$ sudo apt install certbot python3-certbot-nginx -y
Enter fullscreen mode Exit fullscreen mode

2. Generate and install the certificate:

$ sudo certbot --nginx -d rabbitmq.example.com --agree-tos
Enter fullscreen mode Exit fullscreen mode

Certbot updates the Nginx configuration to redirect HTTP to HTTPS automatically.

3. Test the auto-renewal timer:

$ sudo certbot renew --dry-run
Enter fullscreen mode Exit fullscreen mode

Access the Dashboard

Open https://rabbitmq.example.com in a browser and log in with the admin credentials you created. The management interface shows queues, exchanges, connections, and message rates.


Next Steps

RabbitMQ is now running with a secured management interface. From here you can:

  • Create queues and exchanges through the management dashboard or API
  • Integrate RabbitMQ with a Python application using the pika library
  • Set up clustering with additional RabbitMQ nodes for high availability

For the full guide with additional tips, visit the original article on Vultr Docs.

Top comments (0)