How to install rabbitmq on linux machine

What is RabbitMq and How it works:

RabbitMQ is an open source message broker software. It accepts messages from producers, and delivers them to consumers. It acts like a middleman which can be used to reduce loads and delivery times taken by web application servers.

Before installing RabbitMQ, we need to get its main dependencies such as Erlang.

Install Erlang:

And let’s use the below commands to get Erlang on our system.

wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update -y
sudo apt-get install -y erlang erlang-nox

Once we have Erlang, we can continue with installing RabbitMQ. next step is to download the latest RabbitMQ package using wget.

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 -

Update the package list. by using below command.

sudo apt-get update -y

Install RabbitMq by using below command.

sudo apt-get install -y rabbitmq-server

To check the status of the RabbitMQ server use the below command.

sudo systemctl status rabbitmq-server

To run RabbitMQ server as daemon service. enable it by using below command.

sudo systemctl enable rabbitmq-server

Setup RabbitMQ web management console use the below code.

sudo rabbitmq-plugins enable rabbitmq_management

we can create instances in 2 ways. as single and clustered way.

To create admin user in single rabbitmq instance use the below command.

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

Rabbitmq server will run on port 15672. after executing above all commands we can check server working or not by using url

http://localhost:15672 and you can able to see login page. and enter username and password that you given in above commands. After successfull login you can able to see home page of rabbitmq server.