Last updated on November 18th, 2022 at 10:02 am

In this post, I will explain to you how we can install and configure the RabbitMQ server on our Ubuntu server. The below method works on Ubuntu 18.04 & 16.04 LTS. Before we start the installation of the RabbitMQ server I can explain some information about the RabbitMQ server where we can use this server.

What is RabbitMQ?

RabbitMQ is an open-source message broker software that implements Advanced Message Queuing Protocol (AMQP). It was written in the ERLang. RabbitMQ is a very lightweight application and easy to deploy. It gives us a way through which our applications can send messages and communicate, It acts like a middleman which is used to reduce the load and delivery time taken by web application servers.

Where we use RabbitMQ?

We use RabbitMQ where we need to do long-running tasks for example If we want to resize or crop an image or do some other task which takes a long time to complete there we use RabbitMQ it will help your server to respond quickly and in the background, you can do the heavy task.

Installing RabbitMQ server

Step 1. First, we need to add PPA and add the signing key to install RabbitMQ on Ubuntu.

echo "deb https://dl.bintray.com/rabbitmq/debian {distribution} main" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list
curl -fsSL https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc | sudo apt-key add -

Install RabbitMQ Server on Ubuntu

Now we need to update apt-cache and start installing.

sudo apt-get update

Step 2. Installing and configure RabbitMQ server

sudo apt-get install rabbitmq-server -y --fix-missing

install rabbitMQ message broker

Step 3. Now once RabbitMQ is installed we need to enable it you also perform the start-stop operation using the below commands.

sudo systemctl enable rabbitmq-server
sudo systemctl start rabbitmq-server
sudo systemctl stop rabbitmq-server

Enable RabbitMQ server

Step 4. Now we can create an Admin user to manage the RabbitMQ server by default RabbitMQ create a default user with username “guest” and password Enable RabbitMQ server. We can create our own Admin user using the below commands

sudo rabbitmqctl add_user admin my_pasword
sudo rabbitmqctl set_user_tags admin administrator
sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"

Step 5. RabbitMQ has its own web management console you can enable it to use the below command. Web management console helps you to manage your rabbitMQ server.

sudo rabbitmq-plugins enable rabbitmq_management

Once you enable Web console you also need to allow port 15672 to run this console on a web browser.

sudo ufw allow 15672

To access your console enter this URL: http://my_ip_or_domain:15672 from this location you can manage your RabbitMQ.

Hope you like this post.