RabbitMQ is the most popular open source message broker. RabbitMQ is a lightweight application available for most of the popular operating systems. RabbitMQ supports multiple messaging protocols. RabbitMQ can be easily deployed in a distributed and federated configurations to meet high-scale, high-availability requirements.

This tutorial will help you to install RabbitMQ on Ubuntu 18.04 LTS and 16.04 LTS systems.

Prerequisities

Login to your Ubuntu system and update current packages.

sudo apt-get update && sudo apt-get upgrade

Also, included below step based on our readers experieces added in comemnts section. Remove erlang packages already installed on your system.

sudo apt-get purge erlang*

Step 1 – Install RabbitMQ on Ubuntu

First of all, enable RabbitMQ PPA repository on your system. Also, import rabbitmq signing key on your system. Use the following commands to do this.

echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee /etc/apt/sources.list.d/rabbitmq.list
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -

After that update apt cache and install RabbitMQ server on your system.

sudo apt-get update
sudo apt-get install rabbitmq-server

Step 2 – Manage RabbitMQ Service

After completing installations, enable the RabbitMQ service on your system. Also, start the RabbitMQ service. Use one of the below methods sysvinit for older systems or systemctl for the latest operating system.

Using Init –

sudo update-rc.d rabbitmq-server defaults
sudo service rabbitmq-server start
sudo service rabbitmq-server stop

Uisng Systemctl –

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

Step 3 – Create Admin User in RabbitMQ

By default rabbitmq creates a user named “guest” with password “guest”. You can also create your own administrator account on RabbitMQ server using following commands. Change password with your own password.

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

Step 4 – Setup RabbitMQ Web Management Console

RabbitMQ also provides and web management console for managing the entire RabbitMQ. To enable web management console run following command on your system. The web management console helps you with managing the RabbitMQ server.

sudo rabbitmq-plugins enable rabbitmq_management

RabbitMQ dashboard starts on port 15672. Access your server on the port to get the dashboard. Use the username and password created in step 3

install rabbitmq server

After login, you will get the RabbitMQ management web interface dashboard.

install rabbitmq server dashboard