What Is RabbitMQ & Installation Steps On RHEL / CentOS 7 & 8

In this article, you will learn what RabbitMQ is and how to install the latest version on RHEL / CentOS 7&8.

UNDERSTANDING THE SUBJECT MATTER

What Is RabbitMQ?

RabbitMQ is a message broker tool. In one second, have you thought about who or what a broker is? A broker is an intermediary between a seller and a buyer, be it an individual or a firm being the intermediary. Hence, the reason why you have different brokers such as investment brokers, one who acts as an intermediary to facilitate trading and financial securities.

Another type of broker is a real estate broker, one who is an intermediary between the house seller and the buyer or the Landlord and the renter.

Now that you have a broker concept at the back of your mind now, you should probably have an idea of what RabbitMQ is.

It is safe to say that RabbitMQ is an intermediary tool that does messages transactions, a middle-ware, an intermediary software between applications or series of applications and databases for real-time transactions without the need for manual intervention.

Of course, a tool that does messages transactions processes messages and part of message processing involve message queuing. i.e, the transactions of messages(data, task, e.t.c) by accepting messages, queuing them up (which is what it majorly does), and giving out the messages to the required party as at the time when due. so it also safe to say that RabbitMQ is a message-queuing software.

A very quick scenario I can remember at the top of my head right now was when I deployed RHEL servers for a bank to run a core banking application (Temenos t24). The application is an application where other non-core banking applications talk to . The transactions, fetching of messages (data) from one application to the other and databases require integration. The integration can be done by some sort of written code by the bank developers or by a middleware tool such as RabbitMQ.

Other Message Broker Softwares

Other examples of message-broker tools are Microsoft BizTalk, Netweaver PI, Oracle Fusion, IBM Websphere MQ, Fuse ESB, Mule ESB, Azure Event Hub, etc.

Going forward, RabbitMQ also supports Advanced Message Queuing Protocol (AMPQ), Message Queuing Telemetry Transport (MQTT) and HyperText Transfer Protocol (HTTP).

RabbitMQ is always shipped with the Linux OS, of course, may be outdated, and usually not supported anymore. Here are the lists of versions that are not supported. I am going to show you how to install the latest RabbitMQ server which is version 3.8 as of the time I am writing this article.

RabbitMQ is written in Erlang, as such, you will need to install erlang. Installing RabbitMQ 3.8 will require the installation of erlang 21.3. see below the error you will get if the exact version of erlang is not installed.

what is rabbitmq

Enough of what RabbitMQ is, let’s roll down to the installation steps.

ACTION TIME

How To Install RabbitMQ On RHEL / CentOS 7 & 8 Linux System

1. Install erlang, a dependency to intall rabbitmq

  • erlang can be installed from EPEL repository, so install the EPEL repository.

For RHEL / CentOS 7, use the command,

[root@lab01 ~]# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
epel-release-latest-7.noarch.rpm | 15 kB 00:00:00
Examining /var/tmp/yum-root-9pjCLI/epel-release-latest-7.noarch.rpm: epel-release-7-12.noarch
Marking /var/tmp/yum-root-9pjCLI/epel-release-latest-7.noarch.rpm to be installed
Resolving Dependencies
–> Running transaction check
—> Package epel-release.noarch 0:7-12 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

========================
Package Arch Version Repository Size
========================
Installing:
epel-release noarch 7-12 /epel-release-latest-7.noarch 24 k

Transaction Summary
=========================
Install 1 Package

Total size: 24 k
Installed size: 2

For RHEL 8 / CentOS 8, use the command,

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

  • download erlang version 21.3 from github using wget.

if wget is not found on your server, install it by using the command,

[root@HQPRD2 ~]# yum install wget
[root@HQPRD2 ~]# wget https://github.com/rabbitmq/erlang-rpm/releases/download/v21.3.8.6/erlang-21.3.8.6-1.el7.x86_64.rpm

--2020-02-25 06:02:53--  https://github.com/rabbitmq/erlang-rpm/releases/downloa                        d/v21.3.8.6/erlang-21.3.8.6-1.el7.x86_64.rpm
Resolving github.com (github.com)... 140.82.118.3
Connecting to github.com (github.com)|140.82.118.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/476795                        05/da24bd00-a4fe-11e9-81c2-ffdd6a02096a?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-C                        redential=AKIAIWNJYAX4CSVEH53A%2F20200225%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-                        Date=20200225T140254Z&X-Amz-Expires=300&X-Amz-Signature=0355ec423310eb0b1c1eacdc                        b74d61c41ec25156c0e3cbfbb0c5ef0f71680e9f&X-Amz-SignedHeaders=host&actor_id=0&res                        ponse-content-disposition=attachment%3B%20filename%3Derlang-21.3.8.6-1.el7.x86_6                        4.rpm&response-content-type=application%2Foctet-stream [following]
--2020-02-25 06:02:54--  https://github-production-release-asset-2e65be.s3.amazo                        naws.com/47679505/da24bd00-a4fe-11e9-81c2-ffdd6a02096a?X-Amz-Algorithm=AWS4-HMAC                        -

100%[======================================>] 18,871,528   574KB/s   in 28s

2020-02-25 06:03:23 (665 KB/s) - ‘erlang-21.3.8.6-1.el7.x86_64.rpm.1’ saved [188                        71528/18871528]

  • Now install erlang version 21.3
[root@HQPRD2 ~]# yum install erlang-21.3.8.6-1.el7.x86_64.rpm

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Examining erlang-21.3.8.6-1.el7.x86_64.rpm: erlang-21.3.8.6-1.el7.x86_64
Marking erlang-21.3.8.6-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package erlang.x86_64 0:21.3.8.6-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================
 Package         Arch            Version                   Repository                              Size
========================================================================================================
Installing:
 erlang          x86_64          21.3.8.6-1.el7            /erlang-21.3.8.6-1.el7.x86_64           32 M

Transaction Summary
========================================================================================================
Install  1 Package

Total size: 32 M
Installed size: 32 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : erlang-21.3.8.6-1.el7.x86_64                                                         1/1
  Verifying  : erlang-21.3.8.6-1.el7.x86_64                                                         1/1

Installed:
  erlang.x86_64 0:21.3.8.6-1.el7

Complete!
[root@HQPRD2 ~]#
[root@HQPRD2 ~]# erl -version

Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 10.3.5.4

  • To access the erlang shell, use the command,
[root@HQPRD2 ~]# erl

Erlang/OTP 21 [erts-10.3.5.4] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe]

Eshell V10.3.5.4  (abort with ^G)
1>

  • To leave the shell, enter the key, ctrl+c till you leave the shell

2. Add package cloud repository file to the system.

the rabbitmq package is in this repo

[root@HQPRD2 ~]# vi /etc/yum.repos.d/rabbitmq_server.repo
[rabbitmq_server]
name=rabbitmq_server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
[root@HQPRD2 ~]# yum --enablerepo='rabbitmq_server'

3. Install RabbitMQ server

[root@HQPRD2 ~]# yum install rabbitmq-server -y

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
rabbitmq_rabbitmq-server/x86_64/signature                                                                                                        |  833 B  00:00:00
rabbitmq_rabbitmq-server/x86_64/signature                                                                                                        | 1.0 kB  00:00:00 !!!
=====================================================
 Package                                 Arch                           Version                                  Repository                                        Size
========================================================================================================================================================================
Installing:
 rabbitmq-server                         noarch                         3.8.2-1.el7                              rabbitmq_rabbitmq-server                          12 M
Installing for dependencies:
 socat                                   x86_64                         1.7.3.2-2.el7                            rhel-7-server-rpms                               290 k



Total download size: 12 M
Installed size: 14 M
Downloading packages:
(1/2): socat-1.7.3.2-2.el7.x86_64.rpm                                                                                                            | 290 kB  00:00:02
(2/2): rabbitmq-server-3.8.2-1.el7.noarch.rpm                                                                                                    |  12 MB  00:00:26

Installed:
  rabbitmq-server.noarch 0:3.8.2-1.el7

Dependency Installed:
  socat.x86_64 0:1.7.3.2-2.el7


[root@HQPRD2 ~]# rpm -q rabbitmq-server

rabbitmq-server-3.8.2-1.el7.noarch
[root@HQPRD2 ~]#
[root@HQPRD2 ~]# rpm -qi rabbitmq-server

Name        : rabbitmq-server
Version     : 3.8.2
Release     : 1.el7
Architecture: noarch
Install Date: Tue 25 Feb 2020 06:41:12 AM PST
Group       : Development/Libraries
Size        : 13632199
License     : MPLv1.1 and MIT and ASL 2.0 and BSD
Signature   : RSA/SHA256, Mon 02 Dec 2019 01:41:42 AM PST, Key ID 6b73a36e6026dfca
Source RPM  : rabbitmq-server-3.8.2-1.el7.src.rpm
Build Date  : Mon 02 Dec 2019 01:41:40 AM PST
Build Host  : 6b419b7d-65c4-4634-5caa-87e75a6e98ff
Relocations : (not relocatable)
URL         : https://www.rabbitmq.com/
Summary     : The RabbitMQ server
Description :
RabbitMQ is an open source multi-protocol messaging broker.
[root@HQPRD2 ~]#

4. Add the following port to the firewall rule.

[ 1883, 4369, 5671, 5672, 8883, 15672, 25672, 61613, 61614 ]

All these ports have their uses depending on your configuration.

[root@HQPRD2 ~]#  firewall-cmd --add-port={1883,4369,5671,5672,8883,15672,25672,61613,61614}/tcp --permanent


success

[root@HQPRD2 ~]# firewall-cmd --reload

success

5. Start the rabbitmq service

[root@HQPRD2 ~]# systemctl start rabbitmq-server

Enable the service if you wish to.

[root@HQPRD2 ~]# systemctl enable rabbitmq-server

6. Verify that the service is running

[root@HQPRD2 ~]# systemctl status rabbitmq-server

● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2020-02-25 07:10:56 PST; 15s ago
 Main PID: 12879 (beam.smp)
   Status: "Initialized"
   CGroup: /system.slice/rabbitmq-server.service
           ├─12879 /usr/lib64/erlang/erts-10.3.5.4/bin/beam.smp -W w -A 64 -MBas ageffcbf -MHas ageff...
           ├─13057 /usr/lib64/erlang/erts-10.3.5.4/bin/epmd -daemon
           ├─13261 erl_child_setup 32768
           ├─13284 inet_gethost 4
           └─13292 inet_gethost 4


[root@HQPRD2 ~]#
This image has an empty alt attribute; its file name is image-112.png

7. Enable RabitMQ management console to be able to access and manage it from a web browser with GUI if you wish.

[root@HQPRD2 ~]# rabbitmq-plugins enable rabbitmq_management

Enabling plugins on node rabbit@HQPRD2:
rabbitmq_management
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@HQPRD2...
The following plugins have been enabled:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch

set 3 plugins.
Offline change; changes will take effect at broker restart.
[root@HQPRD2 ~]#

8. setup a user account that will able to access the server management console

  • Add the server name to the /etc/hosts file.
[root@HQPRD2 lib]# echo "127.0.0.1 $(hostname -s)" | sudo tee -a /etc/hosts

127.0.0.1 HQPRD2
  • verify that it has been added.
[root@HQPRD2 lib]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 HQPRD2

  • Now set up the user account

rabbitmqctl add_user <username> <password>

[root@HQPRD2 lib]# rabbitmqctl add_user admin Password123

Adding user "admin" ...
[root@HQPRD2 ~]# rabbitmqctl set_user_tags admin administrator

Setting tags for user "admin" to [administrator] ...
[root@HQPRD2 ~]#

9. Access the web Interface

On your browser, enter

<server-IP>:15672

10. Login with the user name and the password you created

Using RabbitMQ commands

How To Check The Status Of RabbitMQ Server In Linux

[root@HQPRD2 ~]# rabbitmqctl status
Status of node rabbit@HQPRD2 ...
Runtime

OS PID: 16869
OS: Linux
Uptime (seconds): 1473
RabbitMQ version: 3.8.2
Node name: rabbit@HQPRD2
Erlang configuration: Erlang/OTP 21 [erts-10.3.5.4] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:64] [hipe]
Erlang processes: 415 used, 1048576 limit
Scheduler run queue: 1
Cluster heartbeat timeout (net_ticktime): 60

Plugins

Enabled plugin file: /etc/rabbitmq/enabled_plugins
Enabled plugins:

 * rabbitmq_management
 * rabbitmq_management_agent
 * rabbitmq_web_dispatch
 * amqp_client
 * cowboy
 * cowlib

Data directory

Node data directory: /var/lib/rabbitmq/mnesia/rabbit@HQPRD2

Config files


Log file(s)

 * /var/log/rabbitmq/rabbit@HQPRD2.log
 * /var/log/rabbitmq/rabbit@HQPRD2_upgrade.log

Alarms

(none)

Memory

Calculation strategy: rss
Memory high watermark setting: 0.4 of available memory, computed to: 0.7632 gb
code: 0.0255 gb (34.96 %)
other_proc: 0.0254 gb (34.79 %)
other_system: 0.0109 gb (14.95 %)
allocated_unused: 0.005 gb (6.84 %)
other_ets: 0.003 gb (4.13 %)
atom: 0.0015 gb (2.01 %)
plugins: 0.0011 gb (1.45 %)
metrics: 0.0002 gb (0.28 %)
mgmt_db: 0.0002 gb (0.24 %)
binary: 0.0001 gb (0.15 %)
mnesia: 0.0001 gb (0.1 %)
quorum_ets: 0.0 gb (0.06 %)
msg_index: 0.0 gb (0.04 %)
connection_other: 0.0 gb (0.0 %)
connection_channels: 0.0 gb (0.0 %)
connection_readers: 0.0 gb (0.0 %)
connection_writers: 0.0 gb (0.0 %)
queue_procs: 0.0 gb (0.0 %)
queue_slave_procs: 0.0 gb (0.0 %)
quorum_queue_procs: 0.0 gb (0.0 %)
reserved_unallocated: 0.0 gb (0.0 %)

File Descriptors

Total: 2, limit: 32671
Sockets: 0, limit: 29401

Free Disk Space

Low free disk space watermark: 0.05 gb
Free disk space: 25.3508 gb

Totals

Connection count: 0
Queue count: 0
Virtual host count: 1

Listeners

Interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Interface: [::], port: 15672, protocol: http, purpose: HTTP API
[root@HQPRD2 ~]#

How To Delete A RabbitMQ user In Linux

To delete a user, use the command,

rabbitmqctl delete_user <user-name>

For example, to delete the user lisa, use the command,

[root@HQPRD2 ~]# rabbitmqctl delete_user lisa
Deleting user "lisa" ...

How To Change A Username Password On RabbitMQ Server In Linux

To change the password for a user, use the command,

rabbitmqctl change_password <user-name> <new-password>

For example, to change the password for the user admin, use the command,

[root@HQPRD2 ~]# rabbitmqctl change_password admin Password1234

Changing password for user "admin" ...
[root@HQPRD2 ~]#

How To Check The Permission Of A RabbitMQ User In Linux

To check the permission of a rabbitmq user, use the command,

rabbitmqctl list_user_permissions <user>

For example, to check the permission of the user admin, use the command,

[root@HQPRD2 ~]# rabbitmqctl list_user_permissions admin

Listing permissions for user "admin" ...

Trouble shooting Steps

If you install the worng version of erlang, you will need to uninstall it by doing the below steps.

  • Uninstall the lower version of erlang.

[root@HQPRD2 ~]# yum remove erlang

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
              : manager
Resolving Dependencies
--> Running transaction check
---> Package erlang.x86_64 0:R16B-03.18.el7 will be erased
--> Processing Dependency: erlang(x86-64) = R16B-03.18.el7 for package: erlang-xamples-R16B-03.18.el7.x86_64
--> Running transaction check
---> Package erlang-examples.x86_64 0:R16B-03.18.el7 will be erased
--> Finished Dependency Resolution
rabbitmq_rabbitmq-server/x86_64/signature                |  833 B     00:00
rabbitmq_rabbitmq-server/x86_64/signature                | 1.0 kB     00:00 !!!
rabbitmq_rabbitmq-server-source/signature                |  836 B     00:00
rabbitmq_rabbitmq-server-source/signature                | 1.0 kB     00:00 !!!

Dependencies Resolved

[root@HQPRD2 ~]# yum remove erlang-erts-R16B-03.18.el7.x86_64

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Resolving Dependencies
--> Running transaction check
---> Package erlang-erts.x86_64 0:R16B-03.18.el7 will be erased
--> Processing Dependency: erlang-erts(x86-64) = R16B-03.18.el7 for package: erlang-typer-R16B-03.18.el7.x86_64
--> Processing Dependency: erlang-erts(x86-64) = R16B-03.18.el7 for package: erlang-mnesia-R16B-03.18.el7.x86_64
--> Processing Dependency: erlang-erts(x86-64) = R16B-03.18.el7 for package: erlang-tools-R16B-03.18.el7.x86_64
--> Processing Dependency: erlang-erts(x86-64) = R16B-03.18.el7 for package: erlang-tv-R16B-03.18.el7.x86_64
--> Processing Dependency: erlang-erts(x86-64) = R16B-03.18.el7 for package: erlang-wx-R16B-03.18.el7.x86_64
--> Processing Dependency: erlang-erts(x86-64) = R16B-03.18.el7 for package: erlang-erl_interface-R16B-03.18.el7.x86_64
--> Processing Dependency: erlang-erts(x86-64) = R16B-03.18.el7 for package: erlang-hipe-R16B-03.18.el7.x86_64
--> Processing Dependency: erlang-erts(x86-64) = R16B-03.18.el7 for package: erlang-cosNotification-R16B-03.18.el7.x86_64
--> Processing Dependency: erlang-erts(x86-64) = R16B-03.18.el7 for package: erlang-gs-R16B-03.18.el7.x86_64
--> Processing Dependency: erlang-erts(x86-64) = R16B-03.18.el7 for package: erlang-diameter-R16B-03.18.el7.x86_64
--> Processing Dependency: erlang-erts(x86-64) = R16B-03.18.el7 for package: erlang-observer-R16B-03.

Tutorial Video On How To Install RabbitMQ On Red Hat /CentOs 7 & 8

Be the first to comment

Leave a Reply

Your email address will not be published.


*