RabbitMQ installation on Ubuntu 22.04|20.04|18.04

11-Apr-2023

RabbitMQ is an open source message broker software that uses Plugins to implement the Advanced Message Queuing Protocol (AMQP), Streaming Text Oriented Messaging Protocol, Message Queuing Telemetry Transport, and other protocols.

A Messaging broker’s job is to receive messages from publishers (apps that publish them) and route them to consumers. (applications that process them). AMQP is a messaging protocol that connects conforming client applications to conforming messaging middleware brokers.

1. To Install Erlang on Ubuntu 22.04|20.04|18.04

RabbitMQ requires Erlang to be installed first before it can run. Erlang is a functional, general-purpose, concurrent programming language and garbage-collected runtime environment supported.

Run the following commands to import Erlang repository GPG key:

sudo apt update
sudo apt install curl software-properties-common apt-transport-https lsb-release
curl -fsSL https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/erlang.gpg

Once you have imported the key, add the repository to your Ubuntu 22.04|20.04|18.04 system by running the following commands:

Ubuntu 22.04:

sudo apt update
sudo apt install erlang

Ubuntu 20.04 / 18.04:

echo "deb https://packages.erlang-solutions.com/ubuntu $(lsb_release -cs)
contrib" | sudo tee /etc/apt/sources.list.d/erlang.list

Update your system package list and install Erlang

sudo apt update
sudo apt install erlang
2. Add RabbitMQ Repository to Ubuntu

Let’s add RabbitMQ Repository to our Ubuntu system.

curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.deb.sh | sudo bash
3. Install RabbitMQ on Ubuntu 22.04|20.04|18.04

To install RabbitMQ Server Ubuntu 22.04|20.04|18.04:

sudo apt update
sudo apt install rabbitmq-server

After installation, RabbitMQ service is started and enabled to start on boot. To check the status, run:

sudo systemctl status rabbitmq-server.service

You can confirm if the service is configured to start on boot using the command:

sudo systemctl enable rabbitmq-server
4. Enable the RabbitMQ Management Dashboard (Optional)

You can optionally enable the RabbitMQ Management Web dashboard for easy management.

sudo rabbitmq-plugins enable rabbitmq_management

The Web service should be listening on TCP port 15672

If you have an active UFW firewall, open both ports 5672 and 15672

Access it by opening the URL http://[server IP|Hostname]:15672

By default, the guest user exists and can connect only from localhost. You can login with this user locally with the password guest

To be able to login on the network, create an admin user like below:

sudo rabbitmqctl add_user admin StrongPassword
sudo rabbitmqctl set_user_tags admin administrator