How to Install RabbitMQ on RHEL 8 / CentOS 8

0
274

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), Message Queuing Telemetry Transport (MQTT), and other protocols. It is written in the Erlang programming language and is built on the Open Telecom Platform framework for clustering and failover.

RabbitMQ is lightweight and easy to deploy on premises and in the cloud. It supports multiple messaging protocols. RabbitMQ can be deployed in distributed and federated configurations to meet high-scale, high-availability requirements.

Step 1: Install EPEL Repo

dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Step 2: Install Erlang

dnf -y install wget
wget https://github.com/rabbitmq/erlang-rpm/releases/download/v21.3.8.6/erlang-21.3.8.6-1.el7.x86_64.rpm

dnf install -y erlang-21.3.8.6-1.el7.x86_64.rpm

Verify your installation of Erlang:

erl

Press Ctrl+C twice to exit from Erlang shell.

Step 3: Add RabbitMQ Repository

Create a Repository file for RabbitMQ using below command

vi /etc/yum.repos.d/rabbitmq-server.repo

now add below lines in that file

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

save changes to file and exit.

Step 4: Install RabbitMQ on RHEL 8 and CentOS 8

Run following commands to install RabbitMQ Server:

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

You can see package details by running below command.

rpm -qi rabbitmq-server

Step 5: Configure firewall and Start RabbitMQ

We have to allow inbound TCP traffic on ports 4369, 25672, 5671, 5672, 15672, 61613, 61614, 1883, and 8883

Run following commands to add ports in firewalld

firewall-cmd --zone=public --permanent --add-port={4369,25672,5671,5672,15672,61613,61614,1883,8883}/tcp

firewall-cmd --reload

Step 5: Enable and use the RabbitMQ management console

Start the RabbitMQ server and enable it on system boot:

systemctl start rabbitmq-server.service

systemctl enable rabbitmq-server.service

Use following command if you want to check RabbitMQ Service status

systemctl status rabbitmq-server.service 
rabbitmqctl status

If you want to monitor RabbitMQ server processes from a web browser, enable RabbitMQ management console using below commands.

rabbitmq-plugins enable rabbitmq_management
chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/

Setup an administrator user account in order to access the RabbitMQ server management console by running following commands.

Note: replace “admin” with your desired username and replace “mypassword” with your desired password you want to set, in below commands.

rabbitmqctl add_user admin mypassword
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"

In order to change user password you can use below command:

rabbitmqctl change_password user-name user-password

 

To delete a user use below command:

rabbitmqctl delete_user user-name

Step 6: Access RabbitMQ Web Managemnet Console:

Open your web browser and visit following URL:

http://YOUR-SERVER-IP:15672

You will see following login page, enter your login details to access console.

Once you enter your login details you will see below page on your browser.

Now You can see connections list, check channels, exchange and create a new queue or delete existing queues from the console.

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here