How to install RabbitMQ on Linux 9

Share on Social Media

In this Linux tutorial, you will learn how to install RabbitMQ on Linux 9 that includes Red Hat based distributions.

What is RabbitMQ:

RabbitMQ is an open-source message broker software that enables applications to communicate and transfer data between each other. It implements the Advanced Message Queuing Protocol (AMQP), which is a widely adopted standard for reliable messaging between different software systems.

At its core, RabbitMQ acts as a mediator or intermediary between two or more applications. It receives messages from a sender, known as a producer, and delivers those messages to a receiver, known as a consumer. The messages are typically organized into queues within RabbitMQ, which provides a way to store and route them.

RabbitMQ supports various messaging patterns, including point-to-point, publish/subscribe, and request/reply. It provides features like message durability, acknowledgments, and routing flexibility, making it a robust and reliable messaging system.

Developers can use RabbitMQ to build distributed and scalable applications that need to handle high volumes of messages and ensure reliable delivery. It is widely used in various industries and scenarios, such as enterprise systems, microservices architectures, event-driven systems, and cloud computing environments.

RabbitMQ is written in Erlang and is known for its stability, performance, and fault-tolerant design. It offers client libraries for multiple programming languages, making it accessible for developers using different technology stacks.

Video to install RabbitMQ on Linux:

YouTube player

Environment Specification:

We are using a minimal Rocky Linux 9 virtual machine with following specifications.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 4 GB
  • Storage – 40 GB
  • Operating System – Rocky Linux release 9.2 (Blue Onyx)
  • Hostname –
  • IP Address –

Prepare your Linux Server:

Login to your Linux server as root user by using a ssh client.

Set a Fully Qualified Domain Name (FQDN) of your Linux machine and set up Local DNS Resolution by executing following commands.

# hostnamectl set-hostname
# echo " rabbitmq-01" >> /etc/hosts

Update software packages in your Linux OS by executing dnf command.

# dnf update -y

If above command installs a new version of Linux Kernel, then you should reboot your Linux OS with new Kernel before installing RabbitMQ software.

# reboot

After reboot, note down the Linux OS and Linux Kernel versions.

# cat /etc/rocky-release
Rocky Linux release 9.2 (Blue Onyx)

# uname -r

Install Additional Yum Repositories:

To install RabbitMQ on Linux, you may need some software packages from Extra Packages for Enterprise Linux (EPEL) yum repository. Therefore, install EPEL yum repository as follows.

# dnf install -y epel-release

You can download RabbitMQ software from their offical website. Or you can install RabbitMQ official yum repository then install Message Broker software by using Linux Package Manager.

We suggest that you should install RabbitMQ on Linux from their official yum repository.

To install RabbitMQ official yum repository, execute following command at Linux terminal.

# curl -s | sudo bash

Similarly, you should also install RabbitMQ ErLang repository.

# curl -1sLf '' | sudo -E bash

Build yum cache for newly installed yum repositories.

# dnf makecache
Extra Packages for Enterprise Linux 9 - x86_64  1.7 kB/s | 6.7 kB     00:03
rabbitmq-rabbitmq-erlang                        376  B/s | 659  B     00:01
rabbitmq-rabbitmq-erlang-noarch                 248  B/s | 659  B     00:02
rabbitmq-rabbitmq-erlang-source                 308  B/s | 659  B     00:02
rabbitmq_rabbitmq-server                        794  B/s | 1.8 kB     00:02
rabbitmq_rabbitmq-server-source                 392  B/s | 951  B     00:02
Rocky Linux 9 - BaseOS                          1.8 kB/s | 4.1 kB     00:02
Rocky Linux 9 - AppStream                       2.6 kB/s | 4.5 kB     00:01
Rocky Linux 9 - Extras                          1.9 kB/s | 2.9 kB     00:01
Metadata cache created.

Install RabbitMQ on Linux:

All required yum repositories have been added. Now you can install RabbitMQ on Linux by using dnf command.

# dnf install -y rabbitmq-server

Enable and start RabbitMQ service.

# systemctl enable --now rabbitmq-server.service
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/rabbitmq-server.service.

Install RabbitMQ Management Plugins:

To enable web based Management Console for your Message Broker Software, you need to install some plugins on your RabbitMQ Server.

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

started 3 plugins.

Configure Linux Firewall:

Identify the service ports, that are being used by RabbitMQ software, execute following commands on Linux terminal.

# ss -tulpn | grep beam
tcp   LISTEN 0      1024                   *    users:(("beam.smp",pid=2172,fd=37))
tcp   LISTEN 0      128                    *    users:(("beam.smp",pid=2172,fd=18))
tcp   LISTEN 0      128                                    *:5672             *:*    users:(("beam.smp",pid=2172,fd=35))

# ss -tulpn | grep epmd
tcp   LISTEN 0      4096                   *    users:(("epmd",pid=2208,fd=3))
tcp   LISTEN 0      4096                                [::]:4369          [::]:*    users:(("epmd",pid=2208,fd=4))

Allow above service ports in Linux firewall.

# firewall-cmd --permanent --add-port={4369,5672,15672,25672}/tcp

# firewall-cmd --reload

Install rabbitmqadmin on Linux:

The management plugin ships with a command line tool rabbitmqadmin which can perform some of the same actions as the Web-based UI, and which may be more convenient for automation tasks.

rabbitmqadmin can be downloaded from any RabbitMQ node that has the management plugin enabled. Navigate to http://{hostname}:15672/cli/rabbitmqadmin to download it. The tool requires a supported version of Python to be installed.

You can use following curl command to download rabbitmqadmin.

# curl http://localhost:15672/cli/rabbitmqadmin -o /usr/local/bin/rabbitmqadmin
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 42533  100 42533    0     0  2307k      0 --:--:-- --:--:-- --:--:-- 2307k

Grant execute permissions to rabbitmqadmin command.

# chmod +x /usr/local/bin/rabbitmqadmin

Create a RabbitMQ Admin User:

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, you need to create another admin user to access RabbitMQ Management web interface remotely.

First, check the already available users on Message Broker server.

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

Execute following command at Linux terminal to create a new RabbitMQ user.

# rabbitmqctl add_user admin P@ssw0rd
Adding user "admin" ...
Done. Don't forget to grant the user permissions to some virtual hosts! See 'rabbitmqctl help set_permissions' to learn more.

Set [administrator] tag for admin user to make it a RabbitMQ Administrator.

# rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...

Check the list of available users again.

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

Create a RabbitMQ Virtual Host:

RabbitMQ is multi-tenant system: connections, exchanges, queues, bindings, user permissions, policies and some other things belong to virtual hosts, logical groups of entities. If you are familiar with virtual hosts in Apache or server blocks in Nginx, the idea is similar. There is, however, one important difference: virtual hosts in Apache are defined in the configuration file; that’s not the case with RabbitMQ: virtual hosts are created and deleted using rabbitmqctl or HTTP API instead.

To create a RabbitMQ virtual host, you can use following Linux command.

# rabbitmqctl add_vhost /my_vhost
Adding vhost "/my_vhost" ...

Check the available virtual host on your Message Broker server.

# rabbitmqctl list_vhosts
Listing vhosts ...

Grant permissions on my_vhost to admin user.

# rabbitmqctl set_permissions -p /my_vhost admin ".*" ".*" ".*"
Setting permissions for user "admin" in vhost "/my_vhost" ...

Check the permissions of admin user.

# rabbitmqctl list_user_permissions admin
Listing permissions for user "admin" ...
vhost   configure       write   read
/my_vhost       .*      .*      .*

Check the permission on my_vhost.

# rabbitmqctl list_permissions -p /my_vhost
Listing permissions for vhost "/my_vhost" ...
user    configure       write   read
admin   .*      .*      .*

Create a Message Queue:

You can create a message queue by using rabbitmqadmin command.

# rabbitmqadmin -V /my_vhost -u admin -p P@ssw0rd declare queue name=my_queue01
queue declared

Send a message to your message queue by using following command.

# rabbitmqadmin -V /my_vhost -u admin -p P@ssw0rd publish routing_key=my_queue01 payload='Hello World!' exchange=amq.default
Message published

Receive the message in your message queue.

# rabbitmqadmin -V /my_vhost -u admin -p P@ssw0rd get queue=my_queue01
| routing_key | exchange | message_count |   payload    | payload_bytes | payload_encoding | properties | redelivered |
| my_queue01  |          | 0             | Hello World! | 12            | string           |            | False       |

Access RabbitMQ Management Web Interface:

Open URL in a web browser.


Login as admin user.


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

Click on “Queues”.


Conclusion – Install RabbitMQ on Linux:

In this Linux tutorial, you have learned how to install RabbitMQ on Linux 9 or other Red Hat based Linux distributions. For more information about using RabbitMQ software, we suggest that you should attend online training RabbitMQ: The Complete Guide with Software Architecture Applicationsudemy-link