RabbitMQ is a widely used and lightweight message broker. It supports multiple messaging protocols and can be deployed on both on-premises and in the cloud infrastructures. RabbitMQ can be deployed as clusters for high availability and throughput and has support for federation across multiple availability zones and regions. In this article I’ll show you how to install RabbitMQ on Amazon Linux 2.
Here are some key features of RabbitMQ:
- Distributed Deployment: Deploy as clusters for high availability and throughput; federate across multiple availability zones and regions.
- Asynchronous Messaging: RabbitMQ supports multiple messaging protocols, message queuing, delivery acknowledgement, flexible routing to queues, multiple exchange type.
- Tools & Plugins: Diverse array of tools and plugins supporting continuous integration, operational metrics, and integration to other enterprise systems
- Management & Monitoring: HTTP-API, command line tool, and UI for managing and monitoring RabbitMQ.
- Enterprise & Cloud Ready: Pluggable authentication, authorisation, supports TLS and LDAP. Lightweight and easy to deploy in public and private clouds.
- Developer Experience: Deploy with BOSH, Chef, Docker and Puppet. Develop cross-language messaging with favorite programming languages such as: Java, .NET, PHP, Python, JavaScript, Ruby, Go, and many others.
Install RabbitMQ on Amazon Linux 2
There are two ways you can use to install RabbitMQ on Amazon Linux 2.
- Installing the package using Yum repositories
- Manually downloading the package and installing it with rpm or yum package management tools.
We’ll use the first method of adding the YUM repository and installing the package from the repository. For simplicity we’ll use Packagecloud repo.
Add RabbitMQ YUM repository to Amazon Linux 2 Server
Run the following commands to add packagecloud RabbitMQ repository.
sudo tee etc/yum.repos.d/rabbitmq_rabbitmq-server.repo<
Also add Erlang repository.
sudo tee /etc/yum.repos.d/rabbitmq_erlang.repo<
Install RabbitMQ on Amazon Linux 2
Once the repository is configured you can use yum package manager tool to install the latest release of RabbitMQ server.
sudo yum install rabbitmq-server
Agree to importation of GPG key prompt:
rabbitmq_erlang/signature | 833 B 00:00:00
Retrieving key from https://packagecloud.io/rabbitmq/erlang/gpgkey
Importing GPG key 0xDF309A0B:
Userid : "https://packagecloud.io/rabbitmq/erlang (https://packagecloud.io/docs#gpg_signing) "
Fingerprint: 2ebd e413 d3ce 5d35 bcd1 5b7c 71c6 3471 df30 9a0b
From : https://packagecloud.io/rabbitmq/erlang/gpgkey
Is this ok [y/N]: y
....
mporting GPG key 0xDF309A0B:
Userid : "https://packagecloud.io/rabbitmq/erlang (https://packagecloud.io/docs#gpg_signing) "
Fingerprint: 2ebd e413 d3ce 5d35 bcd1 5b7c 71c6 3471 df30 9a0b
From : https://packagecloud.io/rabbitmq/erlang/gpgkey
Is this ok [y/N]: y
Review package dependencies and proceed with the installation if you’re okay with it.
Dependencies Resolved
==================================================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================================================
Installing:
rabbitmq-server noarch 3.8.8-1.el6 rabbitmq_rabbitmq-server 15 M
Installing for dependencies:
erlang x86_64 23.0.4-1.el7 rabbitmq_erlang 19 M
ncurses-compat-libs x86_64 6.0-8.20170212.amzn2.1.3 amzn2-core 308 k
socat x86_64 1.7.3.2-2.amzn2.0.1 amzn2-core 291 k
Transaction Summary
==================================================================================================================================================================
Install 1 Package (+3 Dependent packages)
Total download size: 35 M
Installed size: 51 M
Is this ok [y/d/N]: y
Import all required GPG keys.
....
Retrieving key from https://packagecloud.io/rabbitmq/erlang/gpgkey
Importing GPG key 0xDF309A0B:
Userid : "https://packagecloud.io/rabbitmq/erlang (https://packagecloud.io/docs#gpg_signing) "
Fingerprint: 2ebd e413 d3ce 5d35 bcd1 5b7c 71c6 3471 df30 9a0b
From : https://packagecloud.io/rabbitmq/erlang/gpgkey
Is this ok [y/N]: y
Retrieving key from https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
Importing GPG key 0x6026DFCA:
Userid : "RabbitMQ Release Signing Key "
Fingerprint: 0a9a f211 5f46 87bd 2980 3a20 6b73 a36e 6026 dfca
From : https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
Is this ok [y/N]: y
....
Start RabbitMQ Server on Amazon Linux 2
The server is not started as a daemon by default when the RabbitMQ server package is installed. To start the daemon by default when the system boots, as an administrator run
sudo systemctl enable rabbitmq-server
sudo systemctl start rabbitmq-server
Confirm service status:
$ systemctl status rabbitmq-server.service
● rabbitmq-server.service - LSB: RabbitMQ is a multi-protocol messaging broker
Loaded: loaded (/etc/rc.d/init.d/rabbitmq-server; bad; vendor preset: disabled)
Active: active (running) since Tue 2020-09-22 21:23:42 UTC; 38s ago
Docs: man:systemd-sysv-generator(8)
Process: 5615 ExecStart=/etc/rc.d/init.d/rabbitmq-server start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/rabbitmq-server.service
├─5662 /usr/lib64/erlang/erts-11.0.4/bin/epmd -daemon
├─5688 /bin/sh /etc/rc.d/init.d/rabbitmq-server start
├─5694 /bin/bash -c ulimit -S -c 0 >/dev/null 2>&1 ; /usr/sbin/rabbitmq-server
├─5696 /sbin/runuser -u rabbitmq -- /usr/lib/rabbitmq/bin/rabbitmq-server
├─5712 /bin/sh /usr/lib/rabbitmq/bin/rabbitmq-server
├─5729 /usr/lib64/erlang/erts-11.0.4/bin/beam.smp -W w -K true -A 64 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t...
├─5839 erl_child_setup 1024
├─5883 inet_gethost 4
└─5884 inet_gethost 4
Sep 22 21:23:37 amazon-linux systemd[1]: Starting LSB: RabbitMQ is a multi-protocol messaging broker...
Sep 22 21:23:37 amazon-linux runuser[5618]: pam_unix(runuser:session): session opened for user rabbitmq by (uid=0)
Sep 22 21:23:38 amazon-linux runuser[5689]: pam_unix(runuser:session): session opened for user rabbitmq by (uid=0)
Sep 22 21:23:38 amazon-linux runuser[5696]: pam_unix(runuser:session): session opened for user rabbitmq by (uid=0)
Sep 22 21:23:42 amazon-linux rabbitmq-server[5615]: Starting rabbitmq-server: SUCCESS
Sep 22 21:23:42 amazon-linux rabbitmq-server[5615]: rabbitmq-server.
Sep 22 21:23:42 amazon-linux systemd[1]: Started LSB: RabbitMQ is a multi-protocol messaging broker.
RabbitMQ Log files are located in the /var/log/rabbitmq directory.
$ ls -lh /var/log/rabbitmq
total 36K
drwxr-xr-x 2 rabbitmq rabbitmq 23 Sep 22 21:23 log
-rw-r--r-- 1 rabbitmq rabbitmq 21K Sep 22 21:23 [email protected]
-rw-r--r-- 1 rabbitmq rabbitmq 68 Sep 22 21:23 [email protected]_upgrade.log
-rw-r--r-- 1 root root 31 Sep 22 21:23 startup_err
-rw-r--r-- 1 root root 582 Sep 22 21:23 startup_log
Go though RabbitMQ documentation pages to learn more about this software and further tune it to fit your use cases and performance expectations.