RabbitMQ is Open source message broker software. It is written in the Erlang Programming language and is built on the Open Telecom Platform framework for clustering and failover. Client libraries to interface with the broker are available for all major programming languages.
In this article, We will be known about the installation of RabbitMQ on Centos and RHEL.
Before we going to install RabbitMQ, we have to install Erlang Programming language.
#yum -y install gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git #yum -y install epel-release #yum -y install wxBase.x86_64 #wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm #rpm -Uvh erlang-solutions-1.0-1.noarch.rpm #yum -y install erlang
Now Download the latest version of RabbitMQ by using the following command
Once Download completes install it by using the following command
#rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc # rpm -ivh rabbitmq-server-3.6.6-1.el7.noarch.rpm
Now Make sure the following ports can be opened to work RabbitMq properly without preventing Firewalld service
- 4369 (epmd)
- 5672, 5671 (AMQP 0-9-1 and 1.0 without and with TLS)
- 25672. This port used by Erlang distribution for inter-node and CLI tools communication and is allocated from a dynamic range (limited to a single port by default, computed as AMQP port + 20000). See networking guide for details.
- 15672 (if management plugin is enabled)
- 61613, 61614 (if STOMP is enabled)
- 1883, 8883 (if MQTT is enabled)
By using the following commands we can add these ports to firewalld to allow
#firewall-cmd --permanent --add-port=4369/tcp #firewall-cmd --permanent --add-port=5671-5672/tcp #firewall-cmd --permanent --add-port=25672/tcp #firewall-cmd --permanent --add-port=15672/tcp #firewall-cmd --permanent --add-port=61613-61614/tcp #firewall-cmd --permanent --add-port=1883/tcp #firewall-cmd --permanent --add-port=8883/tcp #firewall-cmd --reload
Now start the RabbitMq services by using the following commands
#systemctl start rabbitmq-server #systemctl enable rabbitmq-server
We can also monitor RabbitMQ server via web browser by enabling the RabbitMQ management console by using the following command
[root@localhost ~]# rabbitmq-plugins enable rabbitmq_management The following plugins have been enabled: mochiweb webmachine rabbitmq_web_dispatch amqp_client rabbitmq_management_agent rabbitmq_management Applying plugin configuration to rabbit@localhost... started 6 plugins. [root@localhost ~]# chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/ [root@localhost ~]#
Now access RabbitMQ management console at http://ip-address:15672
The default username and password is guest.But, It can be allowed to login from localhost only. If you want create another account run the following command.
[root@localhost ~]# rabbitmqctl add_user admin admin Creating user "admin" ...
Here the username and password is admin. Now grant permissions to admin user as administrator and full rights.
[root@localhost ~]# rabbitmqctl set_user_tags admin administrator Setting tags for user "admin" to [administrator] ... [root@localhost ~]# rabbitmqctl set_permissions -p / admin ".*" ".*" ".*" Setting permissions for user "admin" in vhost "/" ...
Now enter the username and password to access RabbitMQ web console. The dashboard for RabbitMQ is as follows
Enjoy Linux Have fun.