---
title: How to Install RabbitMQ on Debian 12
url: https://docs.vultr.com/how-to-install-rabbitmq-on-debian-12
description: Learn how to install RabbitMQ on Debian 12 with our step-by-step guide. Set up this powerful message broker for your applications quickly and efficiently.
publish_date: 2024-08-26T13:19:05.371481Z
last_updated: 2026-09-11T16:41:22.174463Z
author: Fredrick Adhing'a
header_image: https://docs.vultr.com/public/doc-assets/1910/23a4fcf3-68e3-4fe5-8302-55af61ab4735.png
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

## Introduction

RabbitMQ is a popular, lightweight, open-source message broker that implements the Advanced Message Queuing Protocol (AMQP). It enables applications to exchange messages asynchronously, decouple them from each other and improve scalability.

This article explains how to install RabbitMQ on Debian 12.

## Prerequisites

Before you begin:

* Deploy a [Debian 12](https://www.vultr.com/servers/debian/) instance on Vultr.
* Create a new [domain **A** record pointing to the instance's IP address](https://docs.vultr.com/introduction-to-vultr-dns). For example, `rabbitmq.example.com`.
* [Access the server using SSH](https://docs.vultr.com/how-to-use-ssh-with-vultr-servers) as a non-root user with sudo privileges
  
## Install RabbitMQ

Erlang is a RabbitMQ dependency package required on a server. [asdf](https://github.com/asdf-vm/asdf) is a CLI tool that can manage language runtime versions on a per-project basis and enables the smooth installation of Erlang. Follow the steps below to enable all dependency packages and install RabbitMQ on your server.

1. Install all required asdf dependencies.

    ```console
    $ sudo apt install curl git -y
    ```

1. Download asdf using the official project repository.

    ```console
    $ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0
    ```

1. Open the `.bashrc` file in your environment.

    ```console
    $ nano ~/.bashrc
    ```

1. Add the following directives at the end of the file.

    ```ini
    . "$HOME/.asdf/asdf.sh"

    . "$HOME/.asdf/completions/asdf.bash"
    ```

    Save and lose the file.

1. Reload the `.bashrc` file in your session.

    ```console
    $ source ~/.bashrc
    ```

1. View the asdf version on your server.

    ```console
    $ asdf --version
    ```

    Output:

    ```
    version: v0.14.0-ccdd47d

    ...
    ```

1. Install the `asdf-erlang` plugin.

    ```console
    $ asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git
    ```

1. Install all necessary Erlang dependencies.

    ```console
    $ sudo apt-get -y install build-essential autoconf m4 libncurses-dev libwxgtk3.2-dev libwxgtk-webview3.2-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils openjdk-17-jdk
    ```

1. Create a new environment variable to skip Java dependency warnings during installation.

    ```console
    $ export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac"
    ```

1. Install the Erlang version `26.1.2`

    ```console
    $ asdf install erlang 26.1.2
    ```

1. Set the global Erlang version to use on the server.

    ```console
    $ asdf global erlang 26.1.2
    ```

1. Access the Erlang shell to verify your installation.

    ```console
    $ erl
    ```

    Output:

    ```
    Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [jit:ns]

    Eshell V14.1.1 (press Ctrl+G to abort, type help(). for help)
    1> 
    ```

    Enter :key_a: and press :key_enter: to exit the Erlang shell.

### Install the RabbitMQ Package

1. Install RabbitMQ.

    ```console
    $ sudo apt install rabbitmq-server -y --fix-missing
    ```

    The above command installs the latest version of RabbitMQ server package and fixes any broken dependencies on your server.

1. View the RabbitMQ service status and verify that it's running.

    ```console
    $ sudo systemctl status rabbitmq-server
    ```

    Output:

    ```
    ● rabbitmq-server.service - RabbitMQ Messaging Server
         Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; preset: enabled)
         Active: active (running) since Mon 2024-08-26 09:35:15 UTC; 25s ago
       Main PID: 50330 (beam.smp)
          Tasks: 22 (limit: 2299)
         Memory: 97.4M
            CPU: 3.131s
    ```

1. Enable the RabbitMQ service to automatically start at system boot.

    ```console
    $ sudo systemctl enable rabbitmq-server
    ```

1. Start the RabbitMQ service.

    ```console
    $ sudo systemctl start rabbitmq-server
    ```

## Configure RabbitMQ

Follow the steps below to configure RabbitMQ on your server.

1. List all RabbitMQ virtual hosts.

    ```console
    $ sudo rabbitmqctl list_vhosts
    ```

1. Create a new RabbitMQ virtual host to use in your applications. Replace `myhost` with your desired virtual host.

    ```console
    $ sudo rabbitmqctl add_vhost myhost
    ```

1. Create a new RabbitMQ user and assign the user a strong password.

    ```console
    $ sudo rabbitmqctl add_user example-user strong-password
    ```

1. Grant the user administrative privileges to use RabbitMQ.

    ```console
    $ sudo rabbitmqctl set_user_tags example-user administrator
    ```

1. Grant the user full permissions to all RabbitMQ virtual hosts, exchanges, queues, bindings, and routing keys.

    ```console
    $ sudo rabbitmqctl set_permissions -p myhost example-user ".*" ".*" ".*"
    ```

## Secure RabbitMQ

Follow the steps below to disable the guest user and secure the RabbitMQ web management console with trusted SSL certificates on your server.

1. Disable the RabbitMQ guest user profile.

    ```console
    $ sudo rabbitmqctl delete_user guest
    ```

1. Open the main RabbitMQ configuration file to enable user authentication.

    ```console
    $ sudo nano /etc/rabbitmq/rabbitmq.conf
    ```

1. Add the following directive at the end of the file.

    ```ini
    auth_backends.1 = internal
    ```

    Save and close the file.

1. Restart RabbitMQ to apply changes.

    ```console
    $ sudo systemctl restart rabbitmq-server
    ```

1. Install the Nginx web server to work as a reverse proxy with RabbitMQ.

    ```console
    $ sudo apt install nginx -y
    ```

1. Create a new Nginx virtual host configuration for RabbitMQ.

    ```console
    $ sudo nano /etc/nginx/sites-available/rabbitmq.conf
    ```

1. Add the following configurations to the file. Replace `rabbitmq.example.com` with your actual domain.

    ```nginx
    server {
           listen 80;
           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;
           proxy_set_header X-Forwarded-Proto $scheme;
      }
      
      location /mqtt {
          proxy_pass http://localhost:15675;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header X-Forwarded-Proto $scheme;
      }
    }
    ```

    Save and close the file.

    The above Nginx configuration listens for incoming network connections on the HTTP port `80` to serve the RabbitMQ console from port `15672` and the `/mqtt` path for web socket connections.

1. Disable the default virtual host configuration.

    ```console
    $ sudo rm /etc/nginx/sites-enabled/default
    ```

1. Create a new symbolic link to the `/sites-enabled` directory to enable the virtual host configuration.

    ```console
    $ sudo ln -s /etc/nginx/sites-available/rabbitmq.conf /etc/nginx/sites-enabled/
    ```

1. Test the Nginx configuration for errors.

    ```console
    $ sudo nginx -t
    ```

    Output:

    ```
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    ```

1. Restart the Nginx service.

    ```console
    $ sudo systemctl restart nginx
    ```

1. Install the Certbot Let's Encrypt client plugin for Nginx.

    ```console
    $ sudo apt install python3-certbot-nginx certbot -y
    ```

1. Allow network connections on the HTTP port `80` through the firewall to enable Let's Encrypt validations.

    ```console
    $ sudo ufw allow 80/tcp
    ```

1. Restart UFW to apply changes.

    ```console
    $ sudo ufw reload
    ```

1. Generate a new SSL certificate to use with your Nginx virtual host and RabbitMQ domain `rabbitmq.example.com`. Replace `hello@example.com` with your actual email.

    ```console
    $ sudo certbot --nginx -d rabbitmq.example.com -m hello@example.com --agree-tos
    ```

    Your output should be similar to the one below when successful.

    ```
    Successfully received certificate.
    Certificate is saved at: /etc/letsencrypt/live/rabbitmq.example.com/fullchain.pem
    Key is saved at:         /etc/letsencrypt/live/rabbitmq.example.com/privkey.pem
    Deploying certificate
    Successfully deployed certificate for rabbitmq.example.com to /etc/nginx/sites-enabled/rabbitmq.conf
    Congratulations! You have successfully enabled HTTPS on https://rabbitmq.example.com
    ```

1. Restart Nginx to apply the SSL configuration changes.

    ```console
    $ sudo systemctl restart nginx
    ```

1. Allow HTTPS connections on port `443` through the firewall.

    ```console
    $ sudo ufw allow 443/tcp
    ```

1. Restart UFW to apply changes.

    ```console
    $ sudo ufw reload
    ```

## Access the RabbitMQ Console

You can access the RabbitMQ console to monitor and manage your server functionalities. Follow the steps below to enable the RabbitMQ management plugin, and access the web administration console to perform tasks such as queue monitoring.

1. Enable the RabbitMQ management plugin.

    ```console
    $ sudo rabbitmq-plugins enable rabbitmq_management
    ```

    Output:

    ```
    The following plugins have been enabled:
      rabbitmq_management
      rabbitmq_management_agent
      rabbitmq_web_dispatch

    started 3 plugins.
    ```

1. View all RabbitMQ plugins and verify that the management plugin is active.

    ```console
    $ sudo rabbitmq-plugins list | grep management
    ```

    Output:

    ```
    [  ] rabbitmq_federation_management    3.10.8
    [E*] rabbitmq_management               3.10.8
    [e*] rabbitmq_management_agent         3.10.8
    [  ] rabbitmq_shovel_management        3.10.8
    [  ] rabbitmq_stream_management        3.10.8
    ```

    Based on the above output, the web administration management plugin is enabled based on the `[E]` prompt.

1. Access your RabbitMQ domain using a web browser such as Chrome to access the web administration console.

    ```
    https://rabbitmq.example.com
    ```

    Enter your administrative RabbitMQ user and password details you created earlier to log in to the console.

    ![RabbitMQ web interface](https://docs.vultr.com/public/doc-assets/1910/4e411ba3-d132-4171-8ade-bd28c8790c82.png)

1. Use the RabbitMQ management interface to view active nodes, users, virtual hosts, queues, exchanges, and perform management tasks on the server.

    ![RabbitMQ management interface](https://docs.vultr.com/public/doc-assets/1910/e67cec24-cd67-4636-b152-43e3d48f5e55.png)

## Conclusion

You have installed RabbitMQ on a Debian 12 server and secured access to the web administration console. RabbitMQ implements message-based architectures, microservices, and distributed systems you can use with existing applications on your server. For more information and configuration options, visit the [RabbitMQ documentation](https://www.rabbitmq.com/docs).
