How can I install RabbitMQ Server on RHEL 8 / CentOS 8 server?. 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/CentOS 8 server.

Step 1: Install EPEL repository

Alot of dependencies are available on the EPEL repository, enable it on your system using our guide below.

How to enable EPEL repository on RHEL 8 / CentOS 8

Step 2: Update System

Once the EPEL repository is added, update your system

sudo yum -y update

Step 3: Add PackageCloud Yum Repository

A Yum repository with RabbitMQ packages is available from PackageCloud.

curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash

Step 4: Install RabbitMQ on RHEL 8 / CentOS 8

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

sudo yum makecache -y --disablerepo='*' --enablerepo='rabbitmq_rabbitmq-server'
sudo yum -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.8.1
Release     : 1.el8
Architecture: noarch
Install Date: Mon 04 Nov 2019 08:30:42 AM EAT
Group       : Development/Libraries
Size        : 13589089
License     : MPLv1.1 and MIT and ASL 2.0 and BSD
Signature   : RSA/SHA256, Fri 01 Nov 2019 02:35:54 AM EAT, Key ID 6b73a36e6026dfca
Source RPM  : rabbitmq-server-3.8.1-1.el8.src.rpm
Build Date  : Fri 01 Nov 2019 02:35:53 AM EAT
Build Host  : 056175bc-c207-4458-54e3-fe5f1985b0ae
Relocations : (not relocatable)
URL         : https://www.rabbitmq.com/
Summary     : The RabbitMQ server
Description :
RabbitMQ is an open source multi-protocol messaging broker.

Step 5: 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 Mon 2019-11-04 08:31:49 EAT; 7s ago
 Main PID: 20790 (beam.smp)
   Status: "Initialized"
    Tasks: 85 (limit: 11512)
   Memory: 86.5M
   CGroup: /system.slice/rabbitmq-server.service
           ├─20790 /usr/lib64/erlang/erts-10.4.4/bin/beam.smp -W w -A 64 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048>
           ├─20965 /usr/lib64/erlang/erts-10.4.4/bin/epmd -daemon
           ├─21092 erl_child_setup 32768
           ├─21113 inet_gethost 4
           └─21114 inet_gethost 4

Nov 04 08:31:49 centos8.novalocal rabbitmq-server[20790]:   Doc guides: https://rabbitmq.com/documentation.html
Nov 04 08:31:49 centos8.novalocal rabbitmq-server[20790]:   Support:    https://rabbitmq.com/contact.html
Nov 04 08:31:49 centos8.novalocal rabbitmq-server[20790]:   Tutorials:  https://rabbitmq.com/getstarted.html
Nov 04 08:31:49 centos8.novalocal rabbitmq-server[20790]:   Monitoring: https://rabbitmq.com/monitoring.html
Nov 04 08:31:49 centos8.novalocal rabbitmq-server[20790]:   Logs: /var/log/rabbitmq/[email protected]
Nov 04 08:31:49 centos8.novalocal rabbitmq-server[20790]:         /var/log/rabbitmq/[email protected]_upgrade.log
Nov 04 08:31:49 centos8.novalocal rabbitmq-server[20790]:   Config file(s): (none)
Nov 04 08:31:49 centos8.novalocal rabbitmq-server[20790]:   Starting broker...systemd unit for activation check: "rabbitmq-server.service"
Nov 04 08:31:49 centos8.novalocal systemd[1]: Started RabbitMQ broker.
Nov 04 08:31:49 centos8.novalocal rabbitmq-server[20790]:  completed with 0 plugins.

RabbitMQ internal details are available on:

sudo rabbitmqctl status 

Step 6: 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