Install Erlang & RabbitMQ on CentOS 7 | Fedora 32/31/30

In this blog post, I’ll take you through the installation of Erlang & RabbitMQ on CentOS 7 | Fedora 32/31/30/29. RabbitMQ is an open source message broker software that implements the Advanced Message Queuing Protocol (AMQP). It receives 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

 

Installing RabbitMQ on CentOS 6 and CentOS 7

Follow the steps below to install RabbitMQ on Fedora 29 / Fedora 28.

Step 1: Install Erlang on CentOS 7 | Fedora 32/31/30

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

Add YUM repository:

sudo tee /etc/yum.repos.d/rabbitmq_erlang.repo<<EOF
[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/x86_64
repo_gpgcheck=1
gpgcheck=1
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
EOF

Install Erlang:

sudo dnf -y install erlang

Confirm installation by running the erl command:

$ erl
Erlang/OTP 23 [erts-11.0.4] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]

Eshell V11.0.4  (abort with ^G)
1>

Step 2: Add PackageCloud RabbitMQ Yum Repository

A Yum repository with RabbitMQ packages is available from PackageCloud.

Create a new Repository file for RabbitMQ.

sudo tee /etc/yum.repos.d/rabbitmq_rabbitmq-server.repo<<EOF
[rabbitmq_rabbitmq-server]
name=rabbitmq_rabbitmq-server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/x86_64
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

[rabbitmq_rabbitmq-server-source]
name=rabbitmq_rabbitmq-server-source
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/SRPMS
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
EOF

Step 3: Install RabbitMQ on CentOS 7 | Fedora 32/31/30

The last step is the actual installation of RabbitMQ:

sudo yum install rabbitmq-server

Confirm version of RabbitMQ installed:

$ rpm -qi rabbitmq-server
Name        : rabbitmq-server
Version     : 3.8.8
Release     : 1.el7
Architecture: noarch
Install Date: Tue 22 Sep 2020 10:10:52 PM UTC
Group       : Development/Libraries
Size        : 16056314
License     : MPLv2.0 and MIT and ASL 2.0 and BSD
Signature   : RSA/SHA256, Thu 03 Sep 2020 05:23:01 PM UTC, Key ID 6b73a36e6026dfca
Source RPM  : rabbitmq-server-3.8.8-1.el7.src.rpm
Build Date  : Thu 03 Sep 2020 05:22:59 PM UTC
Build Host  : 6a1ce918-e5fc-4f1f-6ad7-01a6fb206d97
Relocations : (not relocatable)
URL         : https://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 your Fedora, start and enable the service to start on system boot:

sudo systemctl start rabbitmq-server
sudo systemctl enable rabbitmq-server

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

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 Server IP or hostname port 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
sudo rabbitmqctl set_user_tags admin administrator

Login with this admin username and the password assigned.

RabbitMQ User Management Commands

Delete User:

rabbitmqctl delete_user user

Change User Password:

rabbitmqctl change_password user strongpassword

Create new Virtualhost:

rabbitmqctl add_vhost /my_vhost

List available Virtualhosts:

rabbitmqctl list_vhosts

Delete a virtualhost:

rabbitmqctl delete_vhost /myvhost

Grant user permissions for vhost:

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

List vhost permissions:

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