How to install RabbitMQ on Ubuntu 22.04

Estimated reading: 3 minutes 0 views

In this article we’ll show you a step-by-step guide on how to install and configure a RabbitMQ Server on Ubuntu 22.04 to help you get up and running with this great piece of software.


To follow this guide, you need to meet the following set of requirements:

  • An instance of Ubuntu 22.04.
  • A user with sudo privileges
  • Python 3 with pip package manager installed

Step 1: Install the newest version of Erlang

Install required dependencies

Run the following commands to install the required packages.

apt update
apt install curl software-properties-common apt-transport-https lsb-release

Add Erlang Repository

Once you have imported the key, add the repository to your Ubuntu 22.04 system by running the following commands:

curl -1sLf '' | sudo -E bash

Expected command execution output:

Install Erlang on Ubuntu 22.04

The last step is the actual installation of Erlang. Update your system package list and install Erlang:

apt update
apt install erlang

Check Erlang version:

$ erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell

Step 2: Add RabbitMQ Repository To Ubuntu 22.04

Team RabbitMQ maintains an apt repository on PackageCloud, a package hosting service. It provides packages for most recent RabbitMQ releases.

Let’s add RabbitMQ Repository to our Ubuntu system.

curl -s | sudo bash

Step 3: Install RabbitMQ Server Ubuntu 22.04 LTS

To install RabbitMQ Server Ubuntu 22.04, update apt list, then install rabbitmq-server package:

apt update
apt install rabbitmq-server

Check status:

systemctl status rabbitmq-server.service

Check RabbitMQ version:

sudo rabbitmqctl status | grep RabbitMQ

Check if the service is configured to start on boot or not:

$ systemctl is-enabled rabbitmq-server.service 

If it returns disabled, enable it by running:

systemctl enable rabbitmq-server

Step 4: Check your firewall

After installing RabbitMQ, ufw is enabled and configured by default. If you don’t want that, you can disable it by this command:

ufw disable

Step 5: Enable the RabbitMQ Management Dashboard

You can optionally enable the RabbitMQ Management Web dashboard for easy management.

rabbitmq-plugins enable rabbitmq_management

The Web service should be listening on TCP port 15672.

Double if the port is listening:

$ ss -tunelp | grep 15672

By default, the guest user exists and can connect only from localhost. You can point your browser to http://localhost:15672 and login with this user locally with the password “guest”.

To be able to login on the network, create an admin user like below:

rabbitmqctl add_user admin StrongPassword
rabbitmqctl set_user_tags admin administrator

RabbitMQ User Management Commands

Delete User:

rabbitmqctl delete_user user

Change User Password:

rabbitmqctl change_password user strongpassword

Create new Virtualhost:

rabbitmqctl add_vhost /my_vhost

List available Virtualhosts:

rabbitmqctl list_vhosts

Delete a virtualhost:

rabbitmqctl delete_vhost /myvhost

Grant user permissions for vhost:

rabbitmqctl set_permissions -p /myvhost user ".*" ".*" ".*"

List vhost permissions:

rabbitmqctl list_permissions -p /myvhost

To list user permissions:

rabbitmqctl list_user_permissions user

Delete user permissions:

rabbitmqctl clear_permissions -p /myvhost user

You can buy a VPS starting from $6 by clicking the following image!

Leave a Comment