Ubuntu

Message Broker – RabbitMQ installing in Ubuntu 20.04

Message Broker RabbitMQ installing in Ubuntu 20.04

RabbitMQ is free to install as it is an open-source message broker software. It implements the Advanced Message Queuing Protocol(AMQP). It uses plugins such as Streaming Text Oriented Messaging Protocol, Message Queuing Telemetry Transport.

In this tutorial, we are going to explain the installation process and configuration of RabbitMQ on Ubuntu 20.04 LTS server.

Installation of RabbitMQ on Ubuntu 20.04 LTS

First, let’s update the system and install the required packages with the command as shown below.

$ sudo apt-get update
$ sudo apt-get install wget apt-transport-https -y

Next, run the command as shown below to install the RabbitMQ repository signing key.

$ wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -

Also update erlang GPG key.

$ wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo apt-key add -

Next, add the repository of the RabbitMQ with erlang as shown below.

$ echo "deb https://packages.erlang-solutions.com/ubuntu focal contrib" | sudo tee /etc/apt/sources.list.d/rabbitmq.list

Next, update the packages with the command as shown below.

$ sudo apt-get update

Finally, install the RabbitMQ server with the command as shown below.

$ sudo apt-get install rabbitmq-server -y

Next, start and enable the RabbitMQ server with the command as shown below.

$ sudo systemctl start rabbitmq-server
$ sudo systemctl enable rabbitmq-server

Let’s check the status of the RabbitMQ server with the command as shown below.

$ sudo systemctl status rabbitmq-server

In our case, RabbitMQ service is active and running as shown on above picture.

Command for the RabbitMQ User Management

To create a new user, run the command as shown below.

$ sudo rabbitmqctl add_user admin Password

Here, we are creating a user “admin” with password “Password”

To provide the tags to the user, run the command as shown below.

$ sudo rabbitmqctl set_user_tags admin administrator

To give permission for the newly created users, run the command as shown below.

$ sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"

To change the password of the user, run the command as shown below.

$ sudo rabbitmqctl change_password user new_password

To delete the user, run the command as shown below.

$ sudo rabbitmqctl delete_user user

To create a new virtual host for improved security, run the command as shown below.

$ sudo rabbitmqctl add_vhost /new_vhost

To provide your preferred vhost as grant user permission, run the command as shown below.

$ sudo rabbitmqctl set_permissions -p /vhost user ".*" ".*" ".*"

To list the permission of the vhosts, run the command as shown below.

$ sudo rabbitmqctl list_permissions -p /vhost

To list the virtualhosts available on your server.

$ sudo rabbitmqctl list_vhosts

To delete the virtualhosts available on your server.

$ sudo rabbitmqctl delete_vhost /vhost-name

To list the user permission, run the command as shown below.

$ sudo rabbitmqctl list_user_permissions user

To delete the user permissions, run the command as shown below.

$ sudo rabbitmqctl clear_permissions -p /vhost user

Enabling the RabbitMQ Web Management Dashboard

If you want to interact with the web interface of the RabbitMQ Dashboard, then simply enable the RabbitMQ management with the command as shown below.

$ sudo rabbitmq-plugins enable rabbitmq_management

You will see the similar output after the successful execution of the command.

To enable the port number in the firewall of UFW, run the command as shown below.

$ sudo ufw allow 15672/tcp

As you have enabled the plugin for the web interface of the RabbitMQ, You are allowed to access the page by simply opening the browser and putting the respective url “ http://your_IP:15672”. Check the screenshot as shown below for further details.

Put your username and password to login and view the dashboard of the site. Check the screenshot as shown below for further details.

As you see, we have successfully logged into RabbitMQ dashboard with the admin privilege.

Conclusion

In this article, you have learnt how to install the Message Broker- RabbitMQ in Ubuntu 20.04 LTS Server. We have shown the successful process of the installation of RabbitMQ server and accessing its web dashboard with the above steps. Thank you!

Similar Posts