Share on Social Media

RabbitMQ is an open-source message-broker software built around AMQP protocol. In this guide, you will see how to install RabbitMQ on CentOS 8. #centlinux #linux #rabbitmq

What is RabbitMQ?:

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.

The RabbitMQ server program is written in the Erlang programming language and is built on the Open Telecom Platform framework for clustering and failover. Client libraries to interface with the broker are available for all major programming languages including Java, Erlang and .NET Framework. (Source: Wikipedia)

The RabbitMQ source code is available on GitHub Repository and it is distributed under Mozilla Public License.

Read Also: How to install RabbitMQ on Rocky Linux 9

Environment Specification:

We are using a minimal CentOS 8 virtual machine with following specifications.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 20 GB
  • Operating System – CentOS 8.3
  • Hostname โ€“ rabbitmq-01.centlinux.com
  • IP Address – 192.168.116.230 /24

RabbitMQ Features:

Some of the main features of RabbitMQ are:

  • Reliability
  • Flexible Routing
  • Clustering
  • Federation Model
  • Highly Available Queues
  • Multi-protocol
  • Management UI
  • Tracing
  • Plugin System
  • Large Community
  • Commercial Support

You may find the complete RabbitMQ features on their official website.

Update Your Linux Operating System:

Use a ssh client to connect with rabbitmq-01.centlinux.com server as Linux root user.

Update software packages in your Linux operating system to the latest stable releases by using dnf command.

You may read our previous article, if you want to completely upgrade CentOS 7 to CentOS 8 operating system.

# dnf update -y

Check the Linux operating system and Kernel version of the virtual machine in use here.

# cat /etc/redhat-release
CentOS Linux release 8.3.2011

# uname -r
4.18.0-240.1.1.el8_3.x86_64

Install EPEL Yum Repository:

Some of the required software packages by the message-broker software are available in EPEL (Extra Packages for Enterprise Linux) yum repository.

Therefore, you are required to enable / install EPEL yum repository on your Linux server before installing RabbitMQ.

# dnf install -y epel-release

Install RabbitMQ Yum Repository:

To install a latest version of RabbitMQ software, you can either compile the source code for your preferred Linux distro, or you can add the official yum repository to install the message-broker software from pre-compiled RPM packages.

This software provides a bash script for automated installation of their official yum repository.

Execute the following command to install RabbitMQ yum repository on your Linux server.

# curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
Install RabbitMQ Yum Repository on CentOS 8

Build cache for newly installed yum repositories.

# dnf makecache
CentOS Linux 8 - AppStream                      3.5 kB/s | 4.3 kB     00:01
CentOS Linux 8 - BaseOS                         4.3 kB/s | 3.9 kB     00:00
CentOS Linux 8 - Extras                         1.5 kB/s | 1.5 kB     00:00
Extra Packages for Enterprise Linux Modular 8 -  27 kB/s | 104 kB     00:03
Extra Packages for Enterprise Linux 8 - x86_64   88 kB/s | 8.7 MB     01:40
rabbitmq_rabbitmq-server                         99  B/s | 833  B     00:08
rabbitmq_rabbitmq-server-source                 152  B/s | 819  B     00:05
Metadata cache created.

Install RabbitMQ on CentOS 8:

Now, you can easily install RabbitMQ on CentOS 8 by using a dnf command. All the dependencies will be resolved automatically because you have already setup the EPEL yum repository on your Linux server.

# dnf install -y rabbitmq-server
Install RabbitMQ on CentOS 8

Enable and start RabbitMQ service as follows.

# systemctl enable --now rabbitmq-server.service
Created symlink /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service รข /usr/lib/systemd/system/rabbitmq-server.service.

Verify the status of RabbitMQ service.

# systemctl status rabbitmq-server.service
 status of RabbitMQ service

Install RabbitMQ Managment UI on CentOS 8:

Although RabbitMQ software contains sufficient CLI (command line) tools for administration of message-broker server.

But you can optionally install the RabbitMQ management UI to perform GUI based administration.

Execute following command to install RabbitMQ Management UI on your Linux server.

# rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@rabbitmq-01:
rabbitmq_management
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@rabbitmq-01...
The following plugins have been enabled:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch

started 3 plugins.

Verify that the RabbitMQ Management UI service is running on default port 15672.

# ss -tulpn | grep 15672
tcp     LISTEN   0        128              0.0.0.0:15672          0.0.0.0:*      users:(("beam.smp",pid=2949,fd=98))

To allow incoming traffic to RabbitMQ Management UI, you are required to allow the default service port 15672/tcp in Linux firewall.

Further, RabbitMQ uses port 5672/tcp for AMQP protocol based queues. Therefore, you should also enable it in the Linux Firewall.

Execute the following command to allow required ports in Linux firewall.

# firewall-cmd --permanent --add-port={5672,15672}/tcp
success
# firewall-cmd --reload
success

Create Admin User for RabbitMQ Management UI:

RabbitMQ software shipped with a default user guest with password guest. This guest user has administrative privileges but it can only be login to message-broker server from localhost.

Therefore, we need to create another admin user to access RabbitMQ Management UI remotely.

First, check the already available users on message-broker server.

# rabbitmqctl list_users
Listing users ...
user    tags
guest   [administrator]

Now, execute following command at Linux command line to create a new user for administration of RabbitMQ server.

# rabbitmqctl add_user admin Str0ngP@ssw0rd
Adding user "admin" ...
# rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...

Open URL http://rabbitmq-01.centlinux.com:15672/ in a web browser.

RabbitMQ Management UI Login

Login as admin user that you have created in previous steps.

RabbitMQ Dashboard

After successful login, you may reach at the dashboard of RabbitMQ Management UI. You can perform complete administration of your message-broker server from here.

We strongly recommend that you should buy and read RabbitMQ in Depth (PAID LINK) by Manning Publications to grow your knowledge in this area and to learn to use the RabbitMQ server for your applications.

Conclusion:

In this guide, you have successfully learned how to install RabbitMQ on CentOS 8.

2 thoughts on “How to install RabbitMQ on CentOS 8”

Leave a Reply

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