How to Install RabbitMQ on CentOS 7

RabbitMQ is software that is cross-platform-oriented. RabbitMQ is an open-source message broker written in the Erlang programming language. This software consists of a server, libraries supporting HTTP, XMPP and STOMP [en] protocols, AMQP client libraries for Java and .NET Framework, and various plugins (such as plugins for monitoring and control via HTTP or web interface or plugin “Shovel” to transfer messages between brokers). There is a client implementation for accessing RabbitMQ for a number of programming languages, including Perl, Python, Ruby, PHP. Horizontal scaling is supported for building cluster solutions.

Update your System files

First, before installing the software, you need to update the packages for the latest state (CentOS 7updates are taken into account here)

sudo yum install epel-release
sudo yum update
sudo reboot

Installing Erlang

Since this software is written in the Erlang programming language, before installing RabbitMQ you need to install this particular programming language

cd ~
wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
sudo rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
sudo yum install erlang

To check the Erlang installation you need the enter the following command

erl

Then you’ll be taken to the Erlang shell like this :

Erlang/OTP 18 [erts-7.3] [source-d2a6d81] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.3  (abort with ^G)
1>

Ctrl + C Press twice to exit the Erlang shell.

Install RabbitMQ

In order for you to have access to the RabbitMQ remote control console, you first need to open permission for incoming TCP traffic on ports 4369, 25672, 5671, 5672, 15672, 61613, 61614, 1883, and 8883.

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

Next, you need to start your RabbitMQ server. After a successful start, enable it to start automatically on every system boot

sudo systemctl start rabbitmq-server.service
sudo systemctl enable rabbitmq-server.service

In order to check the status of your RabbitMQ server, you need to enter the following command:

sudo rabbitmqctl status

Enable using RabbitMQ Management Console

This is an important step to enable the RabbitMQ management console. It is needed to track RabbitMQ server processes from a web browser:

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

Next, you need to set up an administrator account to access the RabbitMQ server management console. In the following commands, “mqadmin” is the administrator username and “mqadminpassword” is the password. Remember to replace them with your own

sudo rabbitmqctl add_user mqadmin mqadminpassword
sudo rabbitmqctl set_user_tags mqadmin administrator
sudo rabbitmqctl set_permissions -p / mqadmin .....

Now visit the following URL:

http://[your-hostry-IPv4]:15672/

Now, after successfully completing all the necessary steps, you will be able to log in with the credentials that you provided earlier. You will be greeted by the RabbitMQ Remote Management Console, where you can learn more about RabbitMQ.

Was this article helpful?

Related Articles