How To

How To Install And Manage RabbitMQ In Ubuntu

Google+ Pinterest LinkedIn Tumblr

RabbitMQ is a most popular, lightweight, easy to use open source message broker in the market. It is an implementation of AMQP(Advanced Message Queuing Protocol ) written in the Erlang programming language. In this article, we are going to tell you how to install and manage RabbitMQ in the Ubuntu Operating System.

When Should You Use RabbitMQ

Any type of message brokering solution acts as a middleman for various services of your web applications. Normal HTTP protocol works on request/response architecture that means when a client( browser/mobile/other) request something on the server then they wait for the valid response from the server. However, there are times when it’s absolutely the right thing to do. But sometimes there are some tasks which would normally take quite a bit of time to process then at this moment, It is very annoying for the client to wait for this heavy task. In such cases, RabbitMQ plays a vital role to reduce the loads and response time of the server. Apart from this below are some cases where you can use it as your message broker

  • Allowing web server to respond to request quickly
  • Introducing asynchronous functionality to the backend systems
  • Increase the reliability and uptime of your application
  • And much more…

Installing RabbitMQ In Ubuntu

The process of installing it in the Ubuntu operating system is very easy.

Let’s begin the installation process by first updating our system by using the below command

sudo apt-get update
sudo apt-get upgrade

RabbitMQ has written in the Erlang so we need to install Erlang to use its features. To install Erlang, you first need to download the package of it by typing below command in the terminal

wget http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/esl-erlang_20.1-1~ubuntu~xenial_amd64.deb

After running the above command, run below command

sudo dpkg -i esl-erlang_20.1-1\~ubuntu\~xenial_amd64.deb

Now, after running both above commands you have installed Erlang in your system successfully. To verify the Erlang installation type erl in the terminal to enter the shell. Type CTRL + C to quit the shell.

After successful installation of Erlang, we can install RabbitMQ in our Ubuntu OS. Add the RabbitMQ apt repository into the apt directory by running below command

echo "deb https://dl.bintray.com/rabbitmq/debian xenial main" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list

Now Add the public key to trusted key list

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

Now, Run the below command to update the package list

sudo apt-get update

Now, you can install it by running the below command

sudo apt-get install rabbitmq-server

You can start the RabbitMQ server after the successful installation by using the below command

sudo systemctl start rabbitmq-server.service
sudo systemctl enable rabbitmq-server.service

To check the running status, you can use the below command in the terminal

sudo rabbitmqctl status

Managing RabbitMQ

We have installed RabbitMQ in our Ubuntu OS. Now, it’s time to learn how to manage it. Its provides some plugin by using that you can easily manage it in your browser. To monitor its server processes from a web browser, you can run the below command to enable its management console

sudo rabbitmq-plugins enable rabbitmq_management

After enabling the management console, go to your favourite browser and type http://localhost:15672 in the URL box, you will see a page like below

rabbitmq-login-codesquery

By default, Its provides a user with name guest and password guest. Type these credential in the form and login to the management console. You will see a screen like below

rabbitmq-screen-codesquery

You can also create your own administration account by using  the below commands

sudo rabbitmqctl add_user your_new_username your_new_username_password 
sudo rabbitmqctl set_user_tagsyour_new_username administrator
sudo rabbitmqctl set_permissions -p /your_new_username ".*" ".*" ".*"

Conclusion

You have successfully installed RabbitMQ in the Ubuntu operating system. This is the simple explanation of RabbitMQ installation, there are so many articles written by its official website on how to use this or configure according to your needs. You can go through that and learn the more advanced concept of this most popular and widely use message broker.

Write A Comment

Pin It