RabbitMQ is a free open source enterprise messaging agent software. It is written in Erlang and implements the Advanced Message Queuing Protocol (AMQP). It provides a client library for all major programming languages. It supports multiple messaging protocols, message queues, delivery acknowledgments, flexible routing to queues, and multiple exchange types. It also provides an easy-to-use HTTP-API, command line tools and a Web UI for managing RabbitMQ; in this tutorial, we will install RabbitMQ on a CentOS 7 server.
Minimal CentOS 7 server
Root Permissions This guide is written as the root user. If you are logged in as the sudo user, run sudo
Before you begin
Check the CentOS version.
# CentOS Linux release 7.5.1810 (Core)
Set up the timezone.
sudo timedatectl set-timezone 'Region/City'
Ensure that your system is up to date.
sudo yum check-upgrade || sudo yum upgrade -y
Install the needed packages.
sudo yum install -y socat git vim unzip epel-release
Disable SELinux and Firewall.
sudo setenforce 0 ; sudo systemctl stop firewalld ; sudo systemctl disable firewalld
Update basic system
Before installing any packages, it is recommended that you update the packages and repositories with the following commands.
sudo yum -y update
RabbitMQ is written in the Erlang language, and in this tutorial we will install the latest version of Erlang to the server. Erlang is not available in the default YUM repository, so you will need to install the EPEL repository. Run the following commands the same.
sudo yum -y install erlang socat
You can now check the Erlang version with the following command.
You will get the following output.
sudo erl -version
Erlang (ASYNC_THREADS,HIPE) (BEAM) emulator version 5.10.4
To switch to the Erlang shell, type the following command.
Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V5.10.4 (abort with ^G)
You can exit the shell twice by pressing ctrl + C. Erlang is now installed on the system and you can now continue to install RabbitMQ.
RabbitMQ provides RPM packages for enterprise Linux systems that are pre-compiled and can be installed directly. The only required dependency is to install Erlang into the system. We have already installed Erlang and we can download RabbitMQ further. Download the Erlang RPM package by running it.
sudo wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server-3.6.10-1.el7.noarch.rpm
If you don't have wget installed, you can run yum -y install wget . You can always find the link to the latest version of the RabbitMQ download page.
Import the GPG key by running:
sudo rpm –import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
Run RPM to install the RPM package:
sudo rpm -Uvh rabbitmq-server-3.6.10-1.el7.noarch.rpm
RabbitMQ is now installed on your system.
You can start the RabbitMQ server process by running the following command.
Systemctl start rabbitmq-server
To start RabbitMQ automatically at boot time, run the following command.
sudo systemctl enable rabbitmq-server
To check the status of the RabbitMQ server, run:
sudo systemctl status rabbitmq-server
Access the web console
Start the RabbitMQ web management console by running:
Rabbitmq-plugins enable rabbitmq_management
Provide ownership of the RabbitMQ file to the RabbitMQ user by running the following command:
sudo chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/
Now you will need to create an administrative user for the RabbitMQ web management console. Run the following commands the same.
sudo rabbitmqctl add_user admin StrongPassword
sudo rabbitmqctl set_user_tags admin administrator
sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
Change the administrator to the preferred username for the admin user. Be sure to change StrongPassword to a very powerful password.
To access the management panel of RabbitMQ, please use your favorite web browser and open the following URL.