Script to install RabbitMQ 3.7.9 on Centos7

Script to install RabbitMQ 3.7.9 on CentOS 7

 

#!/bin/bash

# README
# ONLY VARIABLE REQUIRED IS admin password for "rabbitmqctl add_user admin {MyPassword}"
# PLease change before running script.
#


echo "#######################################################################";
echo "This script will install RabbitMQ 3.7.9 and open relevant firewall rules";
echo "#######################################################################";


yum -y install epel-release
wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
yum -y install erlang socat logrotate
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.9/rabbitmq-server-3.7.9-1.el7.noarch.rpm
rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
rpm -Uvh rabbitmq-server-3.7.9-1.el7.noarch.rpm
systemctl start rabbitmq-server
systemctl enable rabbitmq-server
rabbitmq-plugins enable rabbitmq_management
chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/
rabbitmqctl add_user admin MyPassword
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
firewall-cmd --state
firewall-cmd --zone=public --permanent --add-port=15672/tcp
firewall-cmd --zone=public --permanent --add-port=4369/tcp
firewall-cmd --zone=public --permanent --add-port=25672/tcp
firewall-cmd --zone=public --permanent --add-port=5671-5672/tcp
firewall-cmd --zone=public --permanent --add-port=61613-61614/tcp
firewall-cmd --zone=public --permanent --add-port=1883/tcp
firewall-cmd --zone=public --permanent --add-port=8883/tcp
firewall-cmd --reload