Learn How To Install RabbitMQ on CentOS 7

January 23, 2020

Table of Contents

If you are using a different system, please check our other tutorials.

RabbitMQ is a widely used open-source message broker written in the Erlang programming language. As a message-oriented middleware, RabbitMQ can be used to implement the Advanced Message Queuing Protocol (AMQP) on all modern operating systems.

This article explains how to install RabbitMQ on An ITWeb.Services CentOS 7 server instance.

Prerequisites

Before getting started, you need to:

  • Deploy a brand new IT Web Services CentOS 7 server instance.
  • https://www.itweb.services/tutorials/linux-guides/hot-backups-with-percona-xtrabackup-on-the-one-click-wordpress-app”>IT Web Services article.

Step 1: Update the system

Use the following commands to update your CentOS 7 system to the latest stable status:

sudo yum install epel-release
sudo yum update
sudo reboot

Step 2: Install Erlang

Since RabbitMQ is written in Erlang, you need to install Erlang before you can use RabbitMQ:

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

Verify your installation of Erlang:

erl

You will be brought into the Erlang shell which resembles:

Erlang/OTP 18 [erts-7.3] [source-d2a6d81] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V7.3  (abort with ^G)
1>

Press Ctrl+C twice to quit the Erlang shell.

Step 3: Install RabbitMQ

Use the following commands to install the latest version of RabbitMQ which is 3.6.1 at the time of writing:

cd ~
wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-3.6.1-1.noarch.rpm
sudo rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
sudo yum install rabbitmq-server-3.6.1-1.noarch.rpm

Step 4: Modify firewall rules

In order to access the RabbitMQ remote management console, you need to allow inbound 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

Start the RabbitMQ server and enable it to start on system boot:

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

You can check the status of RabbitMQ with:

sudo rabbitmqctl status

Step 5: Enable and use the RabbitMQ management console

Enable the RabbitMQ management console so that you can monitor the 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 setup an administrator user account for accessing the RabbitMQ server management console. In the following commands, “mqadmin” is the administrator’s username, “mqadminpassword” is the password. Remember to replace them with your own ones.

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-itweb.services-server-IP]:15672/

Log in with the credentials you had specified earlier. You will be greeted with the RabbitMQ remote management console, where you can learn more about RabbitMQ. Enjoy!

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!