RabbitMQ is the most popular open source message broker. RabbitMQ is a lightweight application available for most of the popular operating systems. RabbitMQ supports multiple messaging protocols. RabbitMQ can be easily deployed in a distributed and federated configurations to meet high-scale, high-availability requirements. This tutorial will help you to install RabbitMQ on CentOS/RHEL 7/6 and Fedora systems.
Step 1 – Install Erlang
First, use the following commands to add Erlang yum repository on RHEL based system. You can simply download Erlang repository package from its official website and install on your system.
$ wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm $ sudo rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
Now, you can install Erlang package on your system using the following command. This will install all of its dependencies as well.
$ sudo yum install erlang erlang-nox
Step 2 – Install RabbitMQ Server
After installing requirements, now download the RabbitMQ rpm package as per your operating system version from its official website.
CentOS/RHEL 7 & Fedora >= 19
$ wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.9/rabbitmq-server-3.6.9-1.el7.noarch.rpm
CentOS/RHEL 6 & Fedora < 19
$ wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.9/rabbitmq-server-3.6.9-1.el6.noarch.rpm
After downloading the RabbitMQ server package, import rabbitmq signing key and install it using the following commands.
$ sudo rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc $ sudo yum install rabbitmq-server-3.6.9-1.noarch.rpm
Step 3 – Manage RabbitMQ Service
After completing above installations, enable the RabbitMQ service on your system. Also, start the RabbitMQ service. Use one the below methods sysvinit for older systems or systemctl for the latest operating system.
Using Init – CentOS/RHEL 6 & Fedora < 19
$ sudo update-rc.d rabbitmq-server defaults $ sudo service rabbitmq-server start $ sudo service rabbitmq-server stop
Uisng Systemctl – CentOS/RHEL 7 & Fedora >= 19
$ sudo systemctl enable rabbitmq-server $ sudo systemctl start rabbitmq-server $ sudo systemctl stop rabbitmq-server
Step 4 – Create Admin User in RabbitMQ
By default rabbitmq creates a user named “guest” with password “guest”. You can also create your own administrator account on RabbitMQ server using following commands. Change password with your own password.
$ sudo rabbitmqctl add_user admin password $ sudo rabbitmqctl set_user_tags admin administrator $ sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
Step 5 – Setup RabbitMQ Web Management Console
RabbitMQ also provides and web management console for managing the entire RabbitMQ. To enable web management console run following command on your system. The web management console helps you for managing RabbitMQ server.
$ sudo rabbitmq-plugins enable rabbitmq_management
RabbitMQ dashboard starts on port 15672. Access your server on the port to get dashboard. Use the username and password created in step 4
After login, you will get the RabbitMQ management web interface dashboard.
6 Comments
#!/bin/bash
#rabbitmq-server-install-RHEL-7.9.sh
# Runbook for installing Erlang & RMQ on RHEL 7.9
# Run as the RunID you’re going to use the server with– NOT root
# If run as root, non-root users won’t have access to rabbitmqctl commands and config
# To add a user to the sudoers(wheel) group run this command AS ROOT
# usermod -aG wheel
# Then exit root and logout/login with the RunID to run this script
# Note: If yum says the process is locked by another (PackageKit) just let it keep retrying… it will work
HOSTNAME=mqhost01
# Set Hostname
sudo hostnamectl set-hostname $HOSTNAME –static
hostname
# Make rmq directory
mkdir ~/rmq
chmod 777 ~/rmq
cd ~/rmq
# Check RHEL/Centos release = 7.9
cat /etc/centos-release
# Install Required Enterprise toolkit & wget
sudo yum -y install epel-release wget
# Install Common tools
sudo yum -y install gcc glibc-devel make ncurses-devel openssl-devel autoconf
sudo yum -y install dos2unix
# Check and update repos
sudo yum repolist
wget https://packages.erlang-solutions.com/erlang-solutions-2.0-1.noarch.rpm
# Install erlang dependancies
yes | sudo rpm -Uvh erlang-solutions-2.0-1.noarch.rpm
# Check erlang rpms available
yum –showduplicates list erlang | expand
# Install newest compatible with RHEL 7.9
# While IDIP shows and the layering team created a package to install 24.0 — this is not the correct verion
# sudo yum -y install erlang-24.0.6-1.el7.x86_64
# 24.3 has been updated to remove Vulnerabilities and is the most stable version for RHEL 7.9
sudo yum -y install erlang-24.3.4.1-1.el7.x86_64
erl -version
# Add Rabbitmq repo to yum
cat << EOF | sudo tee /etc/yum.repos.d/rabbitmq.repo
[rabbitmq_rabbitmq-server]
name=rabbitmq_rabbitmq-server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/\$releasever/\$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
EOF
sudo yum -y clean all
sudo yum -y makecache
Check rabbitmq rpms available
yum -y –showduplicates list rabbitmq-server | expand
# Install newest compatible with RHEL 7.9
# Again While IDIP shows and the layering team created a package to install 3.10.5 — this is not the correct verion
# Rabbitmq.org says the highest RHEL 7.9 version is 3.10.0
sudo yum -y install rabbitmq-server-3.10.0-1.el7.noarch
sudo systemctl enable –now rabbitmq-server
systemctl status rabbitmq-server
# Configure RMQ
# syntax: rabbitmqctl add_user username password
sudo rabbitmqctl add_user admin admin
sudo rabbitmqctl set_user_tags admin administrator
sudo rabbitmqctl list_users
sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
# Install Web admin
sudo rabbitmq-plugins enable rabbitmq_management
# Open RMQ firewall ports
sudo firewall-cmd –add-port=25672/tcp –permanent
sudo firewall-cmd –add-port=4369/tcp –permanent
sudo iptables -A INPUT -p tcp -m tcp –dport 4369 -j ACCEPT
sudo iptables -A INPUT -p tcp -m tcp –dport 25672 -j ACCEPT
# Manually stop/start and check status again
sudo rabbitmqctl stop
sudo systemctl enable –now rabbitmq-server
systemctl status rabbitmq-server
echo ''
echo "Check the Admin panel in a browser: http://localhost:15672"
echo "Login : admin / admin"
echo ''
echo "DONE"
Nice document.. I set up Rabbti MQ on Google Cloud VM using RHEl 7 in 15 minutes.
i am facing so many issues by following this document.
[xxx@yyyy ~]# sudo rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
error: Failed dependencies:
epel-release is needed by erlang-solutions-1.0-1.noarch
[xxx@yyyy ~]#
[xxx@yyyy ~]# sudo yum install rabbitmq-server-3.6.9-1.noarch.rpm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.quelquesmots.fr
* extras: centos.mirrors.ovh.net
* updates: centos.mirrors.ovh.net
No package rabbitmq-server-3.6.9-1.noarch.rpm available.
Error: Nothing to do
[xxx@yyyy ~]# rpm -q centos-release
centos-release-7-6.1810.2.el7.centos.x86_64
Hi JOHANZ,
I also faced the same error while creating the user.so I have started the RabbitMQ server then I ran the add user command then it resolved.
Regards,
NKN
Hi ,
I need some clarification for RHEL, i have installed erlang and rabbitmq successfully in centos, Now i am going to install in RHEL so is there any separate steps or separate rpm file for RHEL because in erlang i have installed with centos rpm but in RHEL is there any different rmp for it.
Thanks,
Abhishek
Error eject command:
sudo rabbitmqctl add_user
sudo rabbitmq-plugins enable rabbitmq_management
Error: unable to connect to node rabbit@cntncntrbmq: nodedown
DIAGNOSTICS
===========
attempted to contact: [rabbit@cntncntrbmq]
rabbit@cntncntrbmq:
* connected to epmd (port 4369) on cntncntrbmq
* epmd reports: node ‘rabbit’ not running at all
no other nodes on cntncntrbmq
* suggestion: start the node
current node details:
– node name: ‘rabbitmq-cli-51@cntncntrbmq’
– home dir: /var/lib/rabbitmq
– cookie hash: Z04u01Yoj1XnItHTNo+LRw==