(Last Updated On: May 8, 2019)

How can I install RabbitMQ Server on RHEL 8 / CentOS 8?. This guide has been written to help you install the latest release of RabbitMQ on RHEL / CentOS 8 server or Workstation. RabbitMQ is an open source message broker software that implements the Advanced Message Queuing Protocol (AMQP).

RabbitMQ works by receiving messages from publishers (applications that publish them) and routes them to consumers (applications that process them).

In our previous guides, we covered:

How to install Latest RabbitMQ Server on Ubuntu 18.04 LTS

Installing RabbitMQ on CentOS 6 and CentOS 7

Follow our steps below to have RabbitMQ Server installed and running on your RHEL 8 server.

Step 1: Install Erlang on RHEL / CentOS 8

Before installing RabbitMQ, you must install a supported version of Erlang/OTP.

How To Install Latest Erlang on RHEL / CentOS 8

Step 2: Add PackageCloud Yum Repository

A Yum repository with RabbitMQ packages is available from PackageCloud.

Create a new Repository file for RabbitMQ.

sudo vi /etc/yum.repos.d/rabbitmq_rabbitmq-server.repo

Add:

[rabbitmq_rabbitmq-server]
name=rabbitmq_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

Step 3: Install RabbitMQ on RHEL / CentOS 8

Once you have configured RabbitMQ repository, install RabbitMQ Server on RHEL / CentOS 8 by running below commands.

sudo dnf makecache -y --disablerepo='*' --enablerepo='rabbitmq_rabbitmq-server'
sudo dnf -y install rabbitmq-server

Package details can be queried using rpm command with the option -qi.

$ rpm -qi rabbitmq-server 
Name : rabbitmq-server
Version : 3.7.10
Release : 1.el7
Architecture: noarch
Install Date: Thu 10 Jan 2019 09:30:38 AM EAT
Group : Development/Libraries
Size : 11000951
License : MPLv1.1 and MIT and ASL 2.0 and BSD
Signature : RSA/SHA1, Mon 07 Jan 2019 08:49:43 PM EAT, Key ID 6b73a36e6026dfca
Source RPM : rabbitmq-server-3.7.10-1.el7.src.rpm
Build Date : Mon 07 Jan 2019 08:49:42 PM EAT
Build Host : 43c1c4a4-ef2e-42eb-465d-e51a1986db83
Relocations : (not relocatable)
URL : http://www.rabbitmq.com/
Summary : The RabbitMQ server
Description :
RabbitMQ is an open source multi-protocol messaging broker.

Step 4: Start RabbitMQ Service

Now that you have RabbitMQ installed on RHEL 8, start and enable the service to start on system boot.

echo "127.0.0.1 $(hostname -s)" | sudo tee -a /etc/hosts
sudo systemctl enable --now rabbitmq-server.service

Check the status of RabbitMQ with:

$ systemctl status rabbitmq-server.service 
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2019-01-10 09:38:09 EAT; 1min 56s ago
Main PID: 2417 (beam.smp)
Status: "Initialized"
Tasks: 86 (limit: 11510)
Memory: 84.1M
CGroup: /system.slice/rabbitmq-server.service
├─2417 /usr/lib64/erlang/erts-9.3.3.7/bin/beam.smp -W w -A 64 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 >
├─2583 /usr/lib64/erlang/erts-9.3.3.7/bin/epmd -daemon
├─2751 erl_child_setup 32768
├─2773 inet_gethost 4
└─2774 inet_gethost 4
Jan 10 09:38:07 rhel8.local rabbitmq-server[2417]: ## ##
Jan 10 09:38:07 rhel8.local rabbitmq-server[2417]: ## ## RabbitMQ 3.7.10. Copyright (C) 2007-2018 Pivotal Software, Inc.
Jan 10 09:38:07 rhel8.local rabbitmq-server[2417]: ########## Licensed under the MPL. See http://www.rabbitmq.com/
Jan 10 09:38:07 rhel8.local rabbitmq-server[2417]: ###### ##
Jan 10 09:38:07 rhel8.local rabbitmq-server[2417]: ########## Logs: /var/log/rabbitmq/[email protected]
Jan 10 09:38:07 rhel8.local rabbitmq-server[2417]: /var/log/rabbitmq/[email protected]_upgrade.log
Jan 10 09:38:07 rhel8.local rabbitmq-server[2417]: Starting broker…
Jan 10 09:38:09 rhel8.local rabbitmq-server[2417]: systemd unit for activation check: "rabbitmq-server.service"
Jan 10 09:38:09 rhel8.local systemd[1]: Started RabbitMQ broker.
Jan 10 09:38:09 rhel8.local rabbitmq-server[2417]: completed with 0 plugins.

RabbitMQ internal details are available on:

sudo rabbitmqctl status 

Step 5: Enable the RabbitMQ Management Dashboard (Optional)

You can optionally enable the RabbitMQ Management Web dashboard for easy management.

$ sudo rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node [email protected]:
rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to [email protected]
The following plugins have been enabled:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
started 3 plugins.

The Web service should be listening on TCP port 15672

# ss -tunelp | grep 15672
tcp   LISTEN  0       128                    0.0.0.0:15672        0.0.0.0:*      users:(("beam.smp",pid=9525,fd=71)) uid:111 ino:39934 sk:9 <->

If you have an active Firewalld service, allow ports 5672 and 15672

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

Access it by opening the URL http://[server IP|Hostname]:15672

By default, the guest user exists and can connect only from localhost. You can log in with this user locally with the password “guest”

To be able to login on the network, create an admin user like below:

$ sudo rabbitmqctl add_user admin StrongPassword
Adding user "admin" …

$ sudo rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] …

Login with this admin username and the password assigned. You should see an interface similar to below.

To use rabbitmqadmin command line tool, copy it to your $PATH.

sudo updatedb
sudo cp locate rabbitmqadmin /usr/local/bin/rabbitmqadmin
sudo chmod +x /usr/local/bin/rabbitmqadmin

You need to have python installed and configured to run rabbitmqadmin, see below

How to Install Python 3 / Python 2.7 on RHEL 8

RabbitMQ User Management Commands

Delete User:

sudo rabbitmqctl delete_user user

Change User Password:

sudo rabbitmqctl change_password user strongpassword

Create new Virtualhost:

sudo rabbitmqctl add_vhost /my_vhost

List available Virtualhosts:

sudo rabbitmqctl list_vhosts

Delete a virtualhost:

sudo rabbitmqctl delete_vhost /myvhost

Grant user permissions for vhost:

sudo rabbitmqctl set_permissions -p /myvhost user ".*" ".*" ".*"

List vhost permissions:

sudo rabbitmqctl list_permissions -p /myvhost

To list user permissions:

rabbitmqctl list_user_permissions user

Delete user permissions:

rabbitmqctl clear_permissions -p /myvhost user

The next article to read is:

How to Backup and Restore RabbitMQ Data & Configurations