How to Install RabbitMQ on Ubuntu Server 20.04. In recent times top companies prefer to have a tool that works as a messenger without an extra charge. There is one particular tool that offers unlimited message sending services within the organizations, popularly known as RabbitMQ.
What is RabbitMQ?
RabbitMQ is a widely used and open source message broker software application. The RabbitMQ software is built on the advanced message queuing protocol (AMQP) and extended by using plugin architecture to support streaming text oriented messenger services throughout the business organizations. It provides a common platform to send and receive a message and also facilitates encryption services to maintain confidentiality. RabbitMQ is mainly used by large companies within the industries, an example for the companies which have already adopted RabbitMQ applications are Zalando, Boomerang, WeWork, WunderList and many more.
The RabbitMQ is written using the Erlang programming language, the RabbitMQ server is built based on the “Open telecom platform framework” for clustering message requests from the client. The RabbitMQ executable source codes are released under “Mozilla Public license”.
In this section, we will be explaining how the RabbitMQ Server software sends and receives messages within the organizations. Here is an image that illustrates the overview of the RabbitMQ:
RabbitMQ features
In the above figure, RabbitMQ acts as a middleware for various services like Web Applications, API applications, and etc. They can also be used to reduce the data load and delivery times of the web applications while taking up the resources from third parties.
In this example, we have taken an example of a web application that allows users to upload information to the websites. Later on, a piece of uploaded information will be generated in the form of a PDF and emailed back to the users. This kind of task required a lot of time while exchanging the information and generating them in PDF formats, so to overcome this issue, a message queue will be used.
The basic architecture of the RabbitMQ is very simple, the client side application is called a “producer” that creates messages, then delivers these messages into the “broker”. The server side application is known as a “consumer” that connects to the queue and is subscribed to get proceeds.
All the messages are placed onto a “queue” that is stored until the consumer retrieves them to perform further tasks.
An exchange messenger accepts the PDF format messages from the producers and routes them into the PDF creations or performs corrections.
There are four types of message exchanges available; Direct, Fanout, Topic and Headers.
The RabbitMQ allows users to set up a sophisticated rule for message exchange or message delivery.
This type of messenger application supports STOMP, MQTT, WebSockets, and others.
It has the capability to vary point-to-point, request/ reply, and publish/subscribe messaging.
Offers string authentication and expression-based authorization.
RabbitMQ is a queue, so messages are done away with once consumed, and acknowledgment is also provided.
In RabbitMQ, you can specify message priorities, and consume messages with high priority at the onset.
This software has come up with a variety of advanced features such as persistence, performance reliability, publisher confirms, delivery acknowledgment service provider, and high availability.
RabbitMQ’s producer does not charge anything to send the messages.
This tool is good for simple use cases and offers flexible routing options.
By default, RabbitMQ is not available in the Ubuntu 20.04 default repository. So you will need to install the RabbitMQ repository to your system. Run the following command to install the RabbitMQ repository:
You can check the status of the RabbitMQ using the following command:
systemctl status rabbitmq-server
You will get the following output:
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2021-12-02 09:17:12 UTC; 12s ago
Main PID: 19117 (beam.smp)
Tasks: 22 (limit: 2353)
Memory: 87.0M
CGroup: /system.slice/rabbitmq-server.service
├─19117 /usr/lib/erlang/erts-12.1.5/bin/beam.smp -W w -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 10485>
├─19128 erl_child_setup 32768
├─19168 /usr/lib/erlang/erts-12.1.5/bin/epmd -daemon
├─19188 inet_gethost 4
└─19189 inet_gethost 4
Dec 02 09:17:09 server rabbitmq-server[19117]: Doc guides: https://rabbitmq.com/documentation.html
Dec 02 09:17:09 server rabbitmq-server[19117]: Support: https://rabbitmq.com/contact.html
Dec 02 09:17:09 server rabbitmq-server[19117]: Tutorials: https://rabbitmq.com/getstarted.html
Dec 02 09:17:09 server rabbitmq-server[19117]: Monitoring: https://rabbitmq.com/monitoring.html
Dec 02 09:17:09 server rabbitmq-server[19117]: Logs: /var/log/rabbitmq/rabbit@server.log
Dec 02 09:17:09 server rabbitmq-server[19117]: /var/log/rabbitmq/rabbit@server_upgrade.log
Dec 02 09:17:09 server rabbitmq-server[19117]:
Dec 02 09:17:09 server rabbitmq-server[19117]: Config file(s): (none)
Dec 02 09:17:12 server rabbitmq-server[19117]: Starting broker... completed with 0 plugins.
Dec 02 09:17:12 server systemd[1]: Started RabbitMQ broker.
Create an Administrative User
By default, RabbitMQ can be connected without any username or password. So it is a good idea to set an admin user and password to connect to the RabbitMQ.
You can create an administrator user, set a password, set an administrator tag and set permission using the following commands:
You can list all users permission using the following command:
rabbitmqctl list_permissions -p /
You will get the following output:
Listing permissions for vhost "/" ...
user configure write read
guest .* .* .*
admin .* .* .*
Enable RabbitMQ Web UI
RabbitMQ provides a web based interface to manage the RabbitMQ instance. To access the RabbitMQ web interface, you will need to enable it first.
Run the following command to enable the RabbitMQ web interface:
rabbitmq-plugins enable rabbitmq_management
You will get the following output:
Enabling plugins on node rabbit@server:
rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@server...
The following plugins have been enabled:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
started 3 plugins.
By default, the RabbitMQ web interface listens on port 15672. You can check it using the following command:
How to Install RabbitMQ on Ubuntu Server 20.04. Conclusion
In this post, we talked about what is RabbitMQ message broker and how to install it on Ubuntu 20.04 server. We also explained how to set an Admin user and enable the RabbitMQ Web UI. You can now deploy the RabbitMQ on a production environment and integrate it with your application.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.
00votes
Article Rating
Subscribe
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.