How to deploy RabbitMQ on Ubuntu 18.04 Bionic Beaver server


Read this article to know how to deploy RabbitMQ application on a Ubuntu server. Know the exact set of steps and commands to run RabbitMQ on your Ubuntu 18.04 Bionic Beaver operating system.

RabbitMQ is an indispensable part of most Microservice architecture based applications. To queue tasks and make sure that unavailability of a particular service doesn't affect the whole solution, RabbitMQ is the core part of a solution. Without further ado, let's see how to install and deploy RabbitMQ on Ubuntu 18.04 Bionic Beaver.

Update Ubuntu to the latest stable release


These steps should be done before any new installation to make sure you have the latest stable updates and dependencies installed on your computer.
sudo apt-get update
sudo apt-get upgrade

Install Erlang


RabbitMQ is written in Erlang and therefore you need to install this programming language on your Ubuntu 18.04 computer to be able to run RabbitMQ. You can configure the Erlang repository on your PC by downloading the repository package and installing it.
wget http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/esl-erlang_21.2.4-1~ubuntu~bionic_amd64.deb
sudo dpkg -i esl-erlang_21.2.4-1~ubuntu~bionic_amd64.deb

To verify if the installation is successful, enter
ankit@ankit-VirtualBox:~$ erl
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:10] [kernel-poll:false]

Eshell V9.2 (abort with ^G)
1>

on the Ubuntu terminal. You should be brought inside the Erlang terminal. Use Ctrl+C to get outside of the Erlang console.

Install RabbitMQ on Ubuntu 18.04 Bionic Beaver


Add the RabbitMQ Apt repository to your Apt source list directory
echo "deb deb https://dl.bintray.com/rabbitmq/debian xenial main" | sudo tee -a /etc/apt/sources.list

Add the public key for the RabbitMQ package to your list of trusted keys
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -

Update the package list by running the following command
sudo apt-get update

Install the rabbitmq-server package
sudo apt-get install rabbitmq-server

Start RabbitMQ as a Ubuntu Service


We will start with RabbitMQ application as a service so that it gets started automatically after a server reboot or even if it is killed by any other process or by a user.
sudo systemctl start rabbitmq-server.service
sudo systemctl enable rabbitmq-server.service

Check if RabbitMQ is running or not by running
sudo rabbitmqctl status

Starting RabbitMQ Management Console


Before we start the management console, you might want to create additional users for it. By default, RabbitMQ will have a user "guest" with password "guest". To create an "admin" user with Administrator rights and password as "password", run the following set of commands. You can change your admin username and password to the one of your choices.
sudo rabbitmqctl add_user admin password 
sudo rabbitmqctl set_user_tags admin administrator
sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"

Example:
ankit@ankit-VirtualBox:~/Desktop$ sudo rabbitmqctl add_user Devops Devops
Adding user "Devops" ...
ankit@ankit-VirtualBox:~/Desktop$ sudo rabbitmqctl set_user_tags Devops administrator
Setting tags for user "Devops" to [administrator] ...
ankit@ankit-VirtualBox:~/Desktop$ sudo rabbitmqctl set_permissions -p / Devops ".*" ".*" ".*"
Setting permissions for user "Devops" in vhost "/" ...

Enable the management console of RabbitMQ on Ubuntu with the below command
sudo rabbitmq-plugins enable rabbitmq_management


In your browser, enter http://localhost:15672/ or replace localhost with your machine network IP.
RabbitMQ Login screen
Enter the username and password of the administrator account you created earlier and you should be able to see the main screen where you can create your exchanges, queues, binding and other configurations.
RabbitMQ main screen


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: