Updated on 2026-07-29 GMT+08:00

Manually Deploying RabbitMQ

Overview

This best practice guides you through the manual deployment of RabbitMQ on a Linux ECS. RabbitMQ is a message middleware that uses the Erlang programming language for the Advanced Message Queuing Protocol (AMQP). It originates from the financial system and is used to store and forward messages in the distributed system. RabbitMQ is popular for its high reliability, scalability, availability, and extensive functions.

Prerequisites

  • You have purchased an ECS and bound an EIP to it.

    The ECS must run Ubuntu 24.04/22.04/20.04 or Debian 12.0.0/11.7.0/11.6.0/11.1.0.

  • The rules listed in the following table have been added to the security groups that the target ECS belongs to. For details, see Adding a Security Group Rule.
    Table 1 Security group rules

    Direction

    Priority

    Action

    Type

    Protocol & Port

    Source

    Inbound

    1

    Allow

    IPv4

    TCP: 80

    0.0.0.0/0

    Inbound

    1

    Allow

    IPv4

    TCP: 15672

    0.0.0.0/0

Procedure

This section uses RabbitMQ 3.8.3 as an example. For more versions and installation methods, see Installing RabbitMQ.

  1. Log in to the ECS.

    For details, see Login Overview (Linux).

  2. Install RabbitMQ.

    1. Run the following command to install the dependency packages:
      sudo apt-get install curl gnupg apt-transport-https -y
    2. Download the GPG public keys for RabbitMQ and Erlang and add the public keys to the trusted keyring of the system.
      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
      curl -1sLf https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.E495BB49CC4BBE5B.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg > /dev/null
      curl -1sLf https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.9F4587F226208342.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/rabbitmq.9F4587F226208342.gpg > /dev/null
    3. Add the official APT repositories of RabbitMQ and Erlang to the /etc/apt/sources.list.d/rabbitmq.list file.
      sudo tee /etc/apt/sources.list.d/rabbitmq.list <<EOF
      deb [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa1.novemberain.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main
      deb-src [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa1.novemberain.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main
      deb [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa2.novemberain.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main
      deb-src [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa2.novemberain.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main
      deb [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa1.novemberain.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main
      deb-src [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa1.novemberain.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main
      deb [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa2.novemberain.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main
      deb-src [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa2.novemberain.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main
      EOF
    4. Update the local package index.
      sudo apt-get update -y
    5. Install the Erlang-related packages.
      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
    6. Install RabbitMQ.
      sudo apt-get install rabbitmq-server -y --fix-missing

  3. Configure RabbitMQ.

    1. Configure RabbitMQ to automatically start upon system startup and start RabbitMQ.
      sudo systemctl enable rabbitmq-server
      sudo systemctl start rabbitmq-server
    2. Run the following command to delete the default user:
      sudo rabbitmqctl delete_user guest

      The default username and password of RabbitMQ are both guest.

    3. Run the following command to create a user:
      sudo rabbitmqctl add_user username password

      The username and password are user-defined.

      For example, run the following command:

      sudo rabbitmqctl add_user root 123456
    4. Run the following command to set the user as the administrator:
      sudo rabbitmqctl set_user_tags username administrator

      For example, run the following command:

      sudo rabbitmqctl set_user_tags root administrator
    5. Run the following command to assign all permissions to the user:
      sudo rabbitmqctl set_permissions -p / username ".*" ".*" ".*"

      For example, run the following command:

      sudo rabbitmqctl set_permissions -p / root '.*' '.*' '.*'

  4. Run the following command to enable the RabbitMQ web-based management page:

    sudo rabbitmq-plugins enable rabbitmq_management

    Information similar to the following is displayed:

    [root@ecs-rabbitmq ~]# sudo rabbitmq-plugins enable rabbitmq_management
    Enabling plugins on node rabbit@ecs-rabbitmq:
    rabbitmq_management
    The following plugins have been configured:
      rabbitmq_management
      rabbitmq_management_agent
      rabbitmq_web_dispatch
    Applying plugin configuration to rabbit@ecs-rabbitmq...
    The following plugins have been enabled:
      rabbitmq_management
      rabbitmq_management_agent
      rabbitmq_web_dispatch
    
    started 3 plugins.

  5. Enter http://EIP:15672 in the address bar to access RabbitMQ. If the following page is displayed, RabbitMQ has been installed.

  6. Enter the created username and password to go to the RabbitMQ management page.

Follow-up Operations

If you want to migrate your on-premises single-node or cluster instances to online RabbitMQ instances or migrate RabbitMQ instances of an earlier version to those of a later version, you can migrate services to DMS for RabbitMQ. For details, see Migrating RabbitMQ Services.