How to Install RabbitMQ on Ubuntu 18.04

Daniel Montoya
2 min readDec 9, 2019

Based on RabbitMQ’s official documentation on https://www.rabbitmq.com/install-debian.html

Copy the following script and save it in your server as rabbit.sh:

#!/bin/sh## If sudo is not available on the system,
## uncomment the line below to install it
# apt-get install -y sudo
sudo apt-get update -y## Install prerequisites
sudo apt-get install curl gnupg -y
## Install RabbitMQ signing key
curl -fsSL https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc | sudo apt-key add -
## Install apt HTTPS transport
sudo apt-get install apt-transport-https
## Add Bintray repositories that provision latest RabbitMQ and Erlang 21.x releases
sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list <<EOF
## Installs the latest Erlang 22.x release.
## Change component to "erlang-21.x" to install the latest 21.x version.
## "bionic" as distribution name should work for any later Ubuntu or Debian release.
## See the release to distribution mapping table in RabbitMQ doc guides to learn more.
deb https://dl.bintray.com/rabbitmq-erlang/debian bionic erlang
deb https://dl.bintray.com/rabbitmq/debian bionic main
EOF
## Update package indices
sudo apt-get update -y
## Install rabbitmq-server and its dependencies
sudo apt-get install rabbitmq-server -y --fix-missing

Run the script:

sh rabbit.sh

Once RabbitMQ has been installed, you can check its status:

# Find log file
cd /var/log/rabbitmq
# Replace rabbit@ip-IPADDRESS.log with your file name
cat /var/log/rabbitmq/rabbit@ip-IPADDRESS.log
# Check service status
sudo service rabbitmq-server status

If there are no errors, add a user:

# Replace us3r and passw0rd
sudo rabbitmqctl add_user us3r passw0rd
# Grant necessary permissions
sudo rabbitmqctl set_permissions -p / us3r “.*” “.*” “.*”
# Verify permissions
sudo rabbitmqctl list_permissions

List queues:

sudo rabbitmqctl list_queues

--

--