How to install RabbitMQ on Ubuntu

28/12/2020

In this post, we will see how we can install one of the most popular asynchronous messaging tools, RabbitMQ. According to their official website: “RabbitMQ is the most widely deployed open source message broker”, but what is messaging and being a message broker? Let’s find out.

Messaging

A message is a way of exchanging information between application, servers and processes. When two applications share data among themselves, they can decide when to react to it when they receive the data. To exchange data effectively, one application should be independent of another application. This independence part is where a message broker comes in.

Message Broker

A message broker is an application which stores messages for an application. Whenever an application wants to send data to another application, the app publishes the message onto the message broker. The message broker then finds out which queue this message belongs to, finds out the apps which are connected to that queue and so, those apps can now consume that message.

The message broker app, like RabbitMQ, is responsible for saving that message until there is a consumer for that message. Queues are just virtually infinite buffers which store message packets.

What is RabbitMQ

RabbitMQ is one of the most widely deployed open source message brokers. It is an implementation of the Advanced Message Queuing Protocol which is an open standard. Let’s get started by installing RabbitMQ on our Ubuntu-based machine.

Installing RabbitMQ

We will begin by updating the Ubuntu’s application toolset:

sudo apt-get update
sudo apt-get -y upgrade

Once this is done, we can enable the RabbitMQ application repository:

echo "deb http://www.rabbitmq.com/debian/ testing main" >> /etc/apt/sources.list

This command won’t produce any output:

Now, we can add the verification key of The RabbitMQ package:

curl http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | sudo apt-key add

This cmmand can take upto a few minutes to complete depending upo on the Internet speed:

We can again run the update command now:

apt-get update

We can now finally move on to downloading and installing RabbitMQ server:

sudo apt-get install rabbitmq-server

Let’s see the output for this command:

If you’re willing to manage maximum number of connection from the launch itself, edit the following RabbitMQ config file:

sudo nano /etc/default/rabbitmq-server

Enabling RabbitMQ Management Console

RabbitMQ Management Console is a very useful web application through which we can achieve many tasks very easily, like:

  • Manage users and their permissions and roles
  • Create new queues
  • Manage queues, monitor their consumption rate etc.
  • Purge data which is currently on queues
  • Send and receive messages
  • Memory usage against each queue and by the overall process

Run the following command to enable the RabbitMQ Management Console:

sudo rabbitmq-plugins enable rabbitmq_management

Once this is done, we can visit the following IP to access the RabbitMQ Management Console:

http://localhost:15672/

Once this is done, we can see that management plugin is enabled and consuole is up on above mentioned URL:

Default credentials for this is guest/guest. You can login and see what all operations we can perform:

Use following commands to manage the RabbitMQ server further:

# To start the service:
service rabbitmq-server start

# To stop the service:
service rabbitmq-server stop

# To restart the service:
service rabbitmq-server restart

# To check the status:
service rabbitmq-server status

Conclusion

In general, no manual configuration will be needed with RabbitMQ as it already comes packaged with production-grade configuration. In this lesson, we learned how we can install RabbitMQ and it’s management console.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Hướng dẫn tích hợp tính năng Etherpad trên Jitsi

Hôm nay, Cloud 365 sẽ hướng dẫn các bạn tích hợp công cụ Etherpad để sử dụng trong phòng họp...
30/12/2020

How to Create a Custom Application Launcher with Quicklist in Linux

Many popular applications come with quick shortcuts that can be used to execute a specific action. If you right click on...
29/12/2020

How to Use Manjaro Hardware Detection Tool

Manjaro is based on the well-known Arch Linux. Among all the facilities, Manjaro Hardware Detection Tool is a unique one....
29/12/2020