RabbitMQ Print

  • 0

How to Manually Install RabbitMQ on Ubuntu 24.04

This guide explains how to manually install and configure RabbitMQ on an Ubuntu 24.04 server.

The instructions in this article are based directly on the supplied RabbitMQ Ansible playbook. Instead of allowing Ansible to perform the installation automatically, the commands below allow you to perform the same tasks manually from the Ubuntu terminal.

Difficulty: Beginner
Operating System: Ubuntu 24.04
Application: RabbitMQ

1. What You Will Install

After completing this guide, RabbitMQ will be installed and configured with the following:

  • RabbitMQ Server
  • Erlang dependencies
  • RabbitMQ Management Plugin
  • RabbitMQ administrator account
  • RabbitMQ administrator permissions
  • Default guest user removed
  • RabbitMQ service enabled at system startup

The RabbitMQ Management Console will be available on port 15672, while the AMQP service uses port 5672.


2. Requirements

Before starting, make sure you have:

  • Ubuntu 24.04 installed
  • A user account with sudo privileges
  • Internet access
  • Access to the Ubuntu terminal
  • The IP address of your Ubuntu server

Check your Ubuntu version:

lsb_release -a

Make sure the output shows Ubuntu 24.04.


3. Update Ubuntu

The first step is to update Ubuntu's package information.

Run:

sudo apt update

You can also upgrade existing packages:

sudo apt upgrade -y

Wait for the command to finish before continuing.


4. Install Required Packages

The Ansible playbook installs three packages before configuring the RabbitMQ repositories:

  • curl
  • gnupg
  • apt-transport-https

Install them manually with:

sudo apt install -y curl gnupg apt-transport-https

5. Download the RabbitMQ Signing Key

RabbitMQ packages are downloaded from the RabbitMQ repositories. The signing key is used by Ubuntu to verify the packages.

Run the following command:

curl -1sLf \
"https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" \
| gpg --dearmor \
| sudo tee /usr/share/keyrings/com.rabbitmq.team.gpg > /dev/null

The command creates the following keyring file:

/usr/share/keyrings/com.rabbitmq.team.gpg

Verify that the file exists:

ls -l /usr/share/keyrings/com.rabbitmq.team.gpg

6. Configure the RabbitMQ and Erlang Repositories

The Ansible playbook creates a repository file called rabbitmq.list.

Create the file:

sudo nano /etc/apt/sources.list.d/rabbitmq.list

Copy and paste the following contents into the file:

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

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 main

Important: The last line should use the same noble main repository structure as specified by the playbook. If you are copying from the playbook, use its exact repository lines.

Save the file:

  1. Press CTRL + O
  2. Press ENTER
  3. Press CTRL + X

7. Update APT Again

Ubuntu now needs to read the RabbitMQ repositories that were just added.

sudo apt update

If there are no repository errors, continue to the next step.


8. Install Erlang

RabbitMQ requires Erlang. The supplied Ansible playbook installs the following Erlang packages:

sudo apt 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

Allow the installation to complete.


9. Install RabbitMQ Server

Once Erlang has been installed, install the RabbitMQ server.

sudo apt install -y rabbitmq-server

Verify that RabbitMQ was installed:

sudo rabbitmqctl status

10. Enable the RabbitMQ Service

Enabling the service means RabbitMQ will automatically start when the Ubuntu server boots.

sudo systemctl enable rabbitmq-server

11. Start RabbitMQ

Start the RabbitMQ service:

sudo systemctl start rabbitmq-server

Check the service:

sudo systemctl status rabbitmq-server

Look for:

Active: active (running)

Press Q to exit the status screen.


12. Enable the RabbitMQ Management Plugin

RabbitMQ includes a web-based Management Console. The supplied Ansible playbook enables the rabbitmq_management plugin.

Run:

sudo rabbitmq-plugins enable rabbitmq_management

Check that the plugin is enabled:

sudo rabbitmq-plugins list

Look for:

[E*] rabbitmq_management

13. Check Existing RabbitMQ Users

Before creating the administrator account, check the existing RabbitMQ users.

sudo rabbitmqctl list_users

A new RabbitMQ installation may contain the default guest account.


14. Create the RabbitMQ Administrator

The supplied Ansible playbook uses the following administrator username:

rabbitadmin

The playbook contains a sample password:

ChangeThisStrongPassword123!
Security Warning: Do not use the sample password on a production server. Create your own strong password.

Create the administrator account using:

sudo rabbitmqctl add_user rabbitadmin YOUR_STRONG_PASSWORD

For example:

sudo rabbitmqctl add_user rabbitadmin 'YourStrongPasswordHere'

Replace YourStrongPasswordHere with your own strong password.


15. Give the User Administrator Permissions

The Ansible playbook gives the rabbitadmin user the administrator tag.

Run:

sudo rabbitmqctl set_user_tags rabbitadmin administrator

16. Give the Administrator RabbitMQ Permissions

The playbook uses the default RabbitMQ virtual host:

/

Give rabbitadmin full permissions on this virtual host:

sudo rabbitmqctl set_permissions -p / rabbitadmin ".*" ".*" ".*"

This gives the administrator permission to configure, write, and read RabbitMQ resources.


17. Remove the Default Guest User

The supplied Ansible playbook removes the default RabbitMQ guest user.

Run:

sudo rabbitmqctl delete_user guest

If the guest account has already been removed, RabbitMQ may report that the user does not exist. This can be ignored in that situation.


18. Verify the RabbitMQ Administrator

Run:

sudo rabbitmqctl list_users

You should see an administrator account similar to:

rabbitadmin    [administrator]

19. Check RabbitMQ Service Status

The Ansible playbook checks the RabbitMQ service after installation.

Run:

sudo systemctl status rabbitmq-server

The expected result is:

Active: active (running)

You can also check the service with:

sudo systemctl is-active rabbitmq-server

Expected output:

active

20. Check RabbitMQ Status

The Ansible playbook also runs rabbitmqctl status.

Run:

sudo rabbitmqctl status

If RabbitMQ is running correctly, RabbitMQ server information will be displayed.


21. Check RabbitMQ Ports

RabbitMQ normally provides the following important ports:

Port Purpose
5672 AMQP connections
15672 RabbitMQ Management Console

Check whether the ports are listening:

sudo ss -ltnp | grep -E ':5672|:15672'

22. Open the RabbitMQ Management Console

The Ansible playbook provides the following Management Console address:

http://YOUR_SERVER_IP:15672

Replace YOUR_SERVER_IP with the IP address of your Ubuntu server.

For example:

http://192.168.1.100:15672

Open this address in your web browser.

Log in using:

Setting Value
Username rabbitadmin
Password The password you created

23. If the Management Console Does Not Open

First check whether RabbitMQ is running:

sudo systemctl status rabbitmq-server

Check whether the Management Plugin is enabled:

sudo rabbitmq-plugins list | grep rabbitmq_management

Check whether port 15672 is listening:

sudo ss -ltnp | grep 15672

If you are using UFW, check its status:

sudo ufw status

If your firewall is blocking the Management Console and you intentionally want to allow access to it, run:

sudo ufw allow 15672/tcp

If RabbitMQ clients need to connect through AMQP, port 5672 may also need to be allowed:

sudo ufw allow 5672/tcp
Security Recommendation: Do not expose RabbitMQ ports to the public internet unless this is required. Where possible, restrict access using a firewall, trusted IP addresses, or a VPN.

24. Complete Verification

Run the following commands to verify the installation:

sudo systemctl status rabbitmq-server
sudo rabbitmqctl status
sudo rabbitmqctl list_users
sudo rabbitmq-plugins list | grep rabbitmq_management
sudo ss -ltnp | grep -E ':5672|:15672'

If RabbitMQ is running, the administrator exists, the management plugin is enabled, and the required ports are listening, the installation has completed successfully.


25. Useful RabbitMQ Commands

Check RabbitMQ service

sudo systemctl status rabbitmq-server

Start RabbitMQ

sudo systemctl start rabbitmq-server

Stop RabbitMQ

sudo systemctl stop rabbitmq-server

Restart RabbitMQ

sudo systemctl restart rabbitmq-server

Enable RabbitMQ at startup

sudo systemctl enable rabbitmq-server

Check RabbitMQ status

sudo rabbitmqctl status

List RabbitMQ users

sudo rabbitmqctl list_users

List RabbitMQ plugins

sudo rabbitmq-plugins list

Check RabbitMQ ports

sudo ss -ltnp | grep -E ':5672|:15672'

26. Installation Summary

The manual installation follows the same sequence of operations as the supplied Ansible playbook:

  1. Update the Ubuntu package cache.
  2. Install curl, gnupg and apt-transport-https.
  3. Download the RabbitMQ signing key.
  4. Configure the RabbitMQ and Erlang repositories.
  5. Update the APT package cache.
  6. Install Erlang packages.
  7. Install RabbitMQ Server.
  8. Enable the RabbitMQ service.
  9. Start the RabbitMQ service.
  10. Enable the RabbitMQ Management Plugin.
  11. Check the existing RabbitMQ users.
  12. Create the RabbitMQ administrator.
  13. Assign the administrator tag.
  14. Assign permissions to the administrator.
  15. Remove the default guest user.
  16. Check the RabbitMQ service.
  17. Check RabbitMQ status.

27. Final RabbitMQ Information

Item Value
Application RabbitMQ
Operating System Ubuntu 24.04
RabbitMQ Service rabbitmq-server
Administrator Username rabbitadmin
Virtual Host /
AMQP Port 5672
Management Port 15672
Management Console http://YOUR_SERVER_IP:15672

Installation Complete!
RabbitMQ has been manually installed and configured on Ubuntu 24.04. You can now access the RabbitMQ Management Console using port 15672 and connect applications to RabbitMQ using AMQP on port 5672.

Note: This article is a manual translation of the operations contained in the supplied RabbitMQ Ansible playbook.


Je li Vam ovaj odgovor pomogao?
Back