September 26, 2021
How to install RabbitMQ on Ubuntu

How To Install RabbitMQ on Ubuntu 20.04 LTS

On this article we will discuss how to install RabbitMQ with Erlang/OTP 23.x on Ubuntu 20.04 LTS

Introduction

If our work is related to message brokers, there are several software options that can be selected, including Apache Kafka and RabbitMQ. Selection of the right software depends on the characteristics of the system we are building. Apache Kafka is suitable for complex streams with processing data in multi-stage pipelines while RabbitMQ is suitable for applications that need to support legacy protocols, such as STOMP, MQTT. On this article we will discuss how to install RabbitMQ on Linux Ubuntu 20.04 LTS.



RabbitMQ is an open-source message-broker software (sometimes called message-oriented middleware) that originally implemented the Advanced Message Queuing Protocol (AMQP) and has since been extended with a plug-in architecture to support Streaming Text Oriented Messaging Protocol (STOMP), MQ Telemetry Transport (MQTT), and other protocols

RabbitMQ Installation on Ubuntu Steps

We will use the lastest stable version of RabbitMQ repository for our installation tutorial. The last stable RabbitMQ version is 3.8.3 which was released on September 3, 2020. The installation will be consist of several steps as described below :

  • Prerequisite
  • Add RabbitMQ Repository
  • Install RabbitMQ on Ubuntu
  • Enable RabbitMQ Management Dasboard

Prerequisite

RabbitMQ requires Erlang programming language. We have installed the Erlang/TOP on our Ubuntu system on the previous article. Here’s the Erlang installation on Ubuntu 20.04 LTS article. Another prerequistes are : A user account with sudo or root privileges and sufficient disk for RabbitMQ binnary files.

Add RabbitMQ Repository

After prerequisite are met, the next step is to add RabbitMQ repository ot our Ubuntu system. On this step we will do :

  1. Install RabbitMQ signing key, we will submit the command line :
    curl -fsSL https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc | sudo apt-key add -
  2. Add Bintray repository, we will submit the command line :
    sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list
    < deb https://dl.bintray.com/rabbitmq/debian bionic main> EOF
ramans@otodiginet:~$ curl -fsSL https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc | sudo apt-key add -
[sudo] password for ramans:
OK
ramans@otodiginet:~$ sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list <<EOF
deb https://dl.bintray.com/rabbitmq/debian bionic main
EOF
deb https://dl.bintray.com/rabbitmq/debian bionic main
RabbitMQ Repository addition

3.Install HTTPS transport, bu submitting command line : sudo apt-get install apt-transport-https

ramans@otodiginet:~$ sudo apt-get install apt-transport-https
Reading package lists… Done
Building dependency tree
Reading state information… Done
apt-transport-https is already the newest version (2.0.2ubuntu0.1).
0 upgraded, 0 newly installed, 0 to remove and 329 not upgraded.
install apt-transport-https

Install RabbitMQ on Ubuntu

On this step, we just install RabbitMQ. Before we do the installation, it is recommended if we update our Ubuntu system first, by submitting command line : sudo apt-get update -y then we hit the installation. For the installation we will use the command line : sudo apt-get install rabbitmq-server -y --fix-missing.

ramans@otodiginet:~$ sudo apt-get install rabbitmq-server -y --fix-missing
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
socat
The following NEW packages will be installed:
rabbitmq-server socat
0 upgraded, 2 newly installed, 0 to remove and 329 not upgraded.
Need to get 15.7 MB of archives.
After this operation, 17.3 MB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu focal/main amd64 socat amd64 1.7.3.3-2 [323 kB]
Get:2 https://dl.bintray.com/rabbitmq/debian bionic/main amd64 rabbitmq-server all 3.8.9-1 [15.4 MB]
Fetched 15.7 MB in 38s (411 kB/s)
Selecting previously unselected package socat.
(Reading database … 230632 files and directories currently installed.)
Preparing to unpack …/socat_1.7.3.3-2_amd64.deb …
Unpacking socat (1.7.3.3-2) …
Selecting previously unselected package rabbitmq-server.
Preparing to unpack …/rabbitmq-server_3.8.9-1_all.deb …
Unpacking rabbitmq-server (3.8.9-1) …
Setting up socat (1.7.3.3-2) …
Setting up rabbitmq-server (3.8.9-1) …
Adding group rabbitmq' (GID 136) ... Done. Adding system userrabbitmq' (UID 129) …
Adding new user rabbitmq' (UID 129) with grouprabbitmq' …
Not creating home directory `/var/lib/rabbitmq'.
Created symlink /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service → /lib/systemd/system/rabbitmq-server.service.
Processing triggers for man-db (2.9.1-1) …
Processing triggers for systemd (245.4-4ubuntu3.1) …
RabbitMQ installation on Ubuntu
RabbitMQ installation

The RabbitMQ services was started up when the installation process. To ensure, we will verify the RabbitMQ service by submitting command line : sudo systemctl status rabbitmq-server.

ramans@otodiginet:~$ sudo systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2020-12-04 19:56:15 PST; 5min ago
Main PID: 29505 (beam.smp)
Status: "Initialized"
Tasks: 91 (limit: 9455)
Memory: 101.3M
CGroup: /system.slice/rabbitmq-server.service
├─29505 /usr/lib/erlang/erts-11.1/bin/beam.smp -W w -K true -A 64 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 51>
├─29623 erl_child_setup 32768
├─29653 /usr/lib/erlang/erts-11.1/bin/epmd -daemon
├─29680 inet_gethost 4
└─29681 inet_gethost 4
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]: ########## Licensed under the MPL 2.0. Website: https://rabbitmq.c>
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]: Doc guides: https://rabbitmq.com/documentation.html
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]: Support: https://rabbitmq.com/contact.html
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]: Tutorials: https://rabbitmq.com/getstarted.html
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]: Monitoring: https://rabbitmq.com/monitoring.html
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]: Logs: /var/log/rabbitmq/rabbit@otodiginet.log
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]: /var/log/rabbitmq/rabbit@otodiginet_upgrade.log
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]: Config file(s): (none)
Dec 04 19:56:15 otodiginet rabbitmq-server[29505]: Starting broker… completed with 0 plugins.
Dec 04 19:56:15 otodiginet systemd[1]: Started RabbitMQ broker.

Enable RabbitMQ Management Dasboard

To facilitate the use of RabbitMQ, a web-based dashboard has been provided, where the admin can manage everything related to the RabbitMQ application. For this purpose, we have to enable the RabbitMQ management dashboard by submitting command line : sudo rabbitmq-plugins enable rabbitmq_management.

ramans@otodiginet:~$ sudo rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@otodiginet:
rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@otodiginet…
The following plugins have been enabled:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
started 3 plugins.
Enable RabbitMQ Management Dashboard

The RabbitMQ management dashboard is using port 15672, we will verify it by checking the binding port on the system. For this purpose will submit command line : netstat -an | grep 15672.

ramans@otodiginet:~$ netstat -an | grep 15672
tcp 0 0 0.0.0.0:15672 0.0.0.0:* LISTEN

The RabbitMQ management dashboard will be live at URL : http://[server_rabbitmq_ipadress]:15672. For using this dashboard we will use the username : geust and password: guest for the firstime login, so we can configure (add) another user and setting their privileges.

RabbitMQ Management Dashboard Login
RabbitMQ Management Dashboard Login
RabbitMQ Management Dashboard Main
RabbitMQ Management Dashboard first use

Conclusion

Until here, the RabbitMQ installation on Ubuntu 20.04 LTS has been done successfully. For further tutorial about RabbitMQ, we can visit RabbitMQ official tutorials website.

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *