In need of a robust message broker for high-volume communication on Rocky Linux 9?
Enter RabbitMQ–an open-source, Erlang-written gem trusted for stability, performance, and fault-tolerant design across Linux distributions.
In this guide, we will guide you step-by-step to install RabbitMQ on your machine running Rocky Linux 9.
Let’s dive right in!
What You’ll Need?
For a seamless installation and configuration of RabbitMQ on Rocky Linux 9, you must have the following perquisites:
- Rocky Linux 9 with the latest patches and security updates (guide).
- Verify that the system meets the minimum hardware requirements (guide).
- Ensure that you have SSH client administrative or root permissions (guide).
- A stable internet connection.
Apart from these, there are more prerequisites, which are complex. Hence, they are included along with the steps to avoid confusion.
How to Install RabbitMQ on Rocky Linux 9: Step-by-Step
Step 1: Prepare Your Linux Server
It is necessary to manage your Linux server to avoid potential conflicts or issues that could arise during or after the RabbitMQ installation. Doing so ensures that the RabbitMQ service will function correctly and reliably within the Rocky Linux 9 environment.
Here are the steps to prepare your Linux server:
- Start logging in to your Linux server as a root through the SSH client.
- Once logged in, set a Fully Qualified Domain Name (FQDN) and Local DNS Resolution on your Linux machine using the below commands. Make sure to replace the parts that are in square brackets [ … ] with your machine’s details:
hostnamectl set-hostname [hostname] echo "[IP_Address] rabbitmq-01 [hostname]" >> /etc/hosts
- After successfully setting up FQDN and Local DNS resolution, verify if the changes are reflected using the below command:
$ hostnamectl

- Now, follow the best practice by updating software packages in your Linux OS using the following command:
dnf update –y

- If you have received an update to Rocky Linux 9, we suggest doing it. If there is one and you have installed the newer version or updated the packages, reboot your device using the following command:
reboot
Step 2: Install Additional Repositories
For the seamless installation of RabbitMQ, it’s essential to ensure the EPEL, RabbitMQ, and Erlang repositories are installed.
Here are the steps:
- Install EPEL Repository: As the EPEL repository features many open-source packages which aren’t part of standard Linux distribution, RabbitMQ rely on them for installation. Here is the command to install the EPEL repo:
dnf install -y epel-release

- Install RabbitMQ Repository: For the installation of RabbitMQ software, it is important to install its repository. This approach provides additional control; thus, it is suggested. Here is the command to install the RabbitMQ repo through yum:
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash

- Install Erlang Repository: Erlang repo is crucial for installing RabbitMQ, as it is used to build scalable real-time systems. Also, it ensures that you are obtaining the compatible version required for RabbitMQ. Here is the command to install the Erlang repository:
curl -1sLf 'https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/setup.rpm.sh' | sudo -E bash

- After installing the above three repositories, build yum cache using the below command to ensure the package manager has the latest list of available packages and their dependencies from the configured repositories:
dnf makecache

Once you have installed the required repos and generated the yum cache, you can proceed with the RabbitMQ installation.
Step 3: Install RabbitMQ Software
Unlike installing the repositories, it is quick and easy to install the RabbitMQ software. Here are the steps on how to install and start RabbitMQ software:
- Start by entering the following command to install RabbitMQ software:
dnf install -y rabbitmq-server

- After the installation has finished, enable and start the RabbitMQ service using the following command:
systemctl enable --now rabbitmq-server.service

If there are no errors, you will be displayed with a “Started RabbitMQ messaging server” message indicating that you have successfully installed and enabled RabbitMQ. Next, we will explore how to access and manage your new RabbitMQ instance.
Step 4: Enable RabbitMQ Management Plugins
After installing RabbitMQ, you need a console to manage the software. The best approach is to get the Web-based Management Console. Unfortunately, the console isn’t available unless the plugins are enabled, so here’s how to enable plugins.
- Unlike repositories, it isn’t necessary to enable each plugin manually. Enter the following command to enable all RabbitMQ management plugins:
rabbitmq-plugins enable rabbitmq_management

Step 5: Manage RabbitMQ Service Ports
Once you have enabled the plugins, it is necessary to identify the ports that RabbitMQ is utilizing and allow them. Here are the steps to enable service ports within the Linux firewall.
- Start by identifying the ports utilized by RabbitMQ using the following commands:
ss -tulpn | grep beam ss -tulpn | grep epmd

- After the ports are listed, add them to the firewall and reload the firewall using the following commands:
firewall-cmd --permanent --add-port={4369,5672,15672,25672}/tcp firewall-cmd –reload
It is vital for the message “Success” to appear while adding ports to the Linux Firewall. If there is an error, reboot your device and repeat step 5.
Step 6: Download rabbitmqadmin
Even if the web-based management console is readily available, it cannot automate tasks. In such cases, utilizing the command line tool “rabbitmqadmin” from the management plugin provides additional flexibility.
Here are the steps on how to do so:
- The download of “rabbitmqadmin” can be made from any of its nodes. Use the following command to download it:
curl http://localhost:15672/cli/rabbitmqadmin -o /usr/local/bin/rabbitmqadmin

- After the download, grant permissions to the “rabbitmqadmin” command using the following command:
chmod +x /usr/local/bin/rabbitmqadmin
As the above command doesn’t generate an output, ensure the download was successful and proceed to create a new admin on RabbitMQ.
Step 7: Create a RabbitMQ Admin User
By default, the “guest’ comes with admin privileges on RabbitMQ. With the guest profile, you can log in to the message-broker server from localhost, but it cannot remotely access the RabbitMQ Management web interface.
For this purpose, it is necessary to create a new admin, and here are the steps:
- Create a new user by the name of your choice using the following command:
rabbitmqctl add_user admin Distr0id

- The newly created user named “admin” must be provided with the [administrator] tag. Use the following command to make “admin” an administrator:
rabbitmqctl set_user_tags admin administrator

- Verify the users list to check if the user “admin” is an administrator using the following command:
rabbitmqctl list_users

Before creating RabbitMQ Virtual Host, ensure the user you created is an admin. If there is no admin tag beside the user you have made, repeat Step 7.
Step 8: Create a RabbitMQ Virtual Host
Creating a RabbitMQ Virtual Host is vital, as it ensures that messages and configurations for one application or part of a system don’t interfere with others, providing a more secure and manageable environment.
Here are steps on how to create a RabbitMQ Virtual Host:
- Enter the following command to create a virtual host, which is as simple as creating a user:
rabbitmqctl add_vhost /distroid_vhost

- After creating the virtual host, grant permissions on “distroid_vhost” to the “admin” user created earlier using the following command:
rabbitmqctl set_permissions -p /distroid_vhost admin ".*" ".*" ".*"
- Verify the admin user using the following command to see if the changes are reflected:
rabbitmqctl list_user_permissions admin

- Do the same for the virtual host “/distroid_vhost” using the following command:
rabbitmqctl list_permissions -p /distroid_vhost

You are ready to create message queues once you have successfully RabbitMQ admin and virtual host. However, before proceeding further, we suggest you cross-check that there are no errors and that admin privileges are set correctly.
Step 9: Create a Message Queue
On RabbitMQ, creating Message Queue requires an admin and virtual host. Here are the steps to create a message queue.
- Start by creating a queue through RabbitMQ using the following command:
rabbitmqadmin -V /distroid_vhost -u admin -p Distr0id declare queue name=my_queue01

- Now generate a new message using the following command on the message queue:
rabbitmqadmin -V /distroid_vhost -u admin -p Distr0id publish routing_key=my_queue01 payload='Hello World!' exchange=amq.default

- Now check for the message and verify if the message queue has updated using the following command:
rabbitmqadmin -V /distroid_vhost -u admin -p Distr0id get queue=my_queue01

As you can see, the message has been published, and the message queue has been updated. The last step is checking and accessing the RabbitMQ Management Web Interface.
Before proceeding, ensure that there are no errors. If any errors arise, they might stem from incorrect credentials or mistakes during admin user and virtual host creation. In such cases, revisit Steps 7-9.
Also Read: How to Send a Broadcast Message to Users on Linux
Step 10: Accessing RabbitMQ Management Web Interface
This is the last step, and if you have made it to this step, you have successfully installed and managed RabbitMQ. Here are the steps to access and manage your queues on RabbitMQ’s Web UI.
- Open your browser, navigate to the URL provided, and log in using the admin account created:
http://rabbitmq-01.centlinux.com:15672/

- After you’re logged in, you’re greeted with RabbitMQ’s dashboard. Now look for the option “Queues” on the top menu bar and click on it:

- You can find the queue you created manually under the “Queues” tab:

Conclusion
Congratulations on successfully installing and setting up RabbitMQ on Rocky Linux 9!
With RabbitMQ now running on your system, you’ve empowered your applications with a robust messaging broker, providing a scalable and reliable solution for handling message queues.
If you encounter difficulties or require further assistance with your RabbitMQ setup on Rocky Linux 9, refer to the official RabbitMQ documentation. If the issue persists, feel free to reach out to the knowledgeable communities on both RabbitMQ and Rocky Linux forums.