How to install RabbitMQ on Ubuntu 18.04

Chi Thuc Nguyen
2 min readMay 4, 2020

Step 0: Install newest version of Erlang

$ wget -O- | sudo apt-key add -
$ echo "deb bionic contrib" | sudo tee /etc/apt/sources.list.d/erlang.list


sudo apt update
sudo apt install erlang

Check Erlang version:

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

Step 1: Add RabbitMQ Repository To Ubuntu 18.04

$ wget -O- | sudo apt-key add -
$ wget -O- | sudo apt-key add -


$ echo "deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/rabbitmq.list

Step 2: Install RabbitMQ Server Ubuntu 18.04 LTS

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

sudo apt update
sudo apt install rabbitmq-server

Check status:

sudo systemctl status  rabbitmq-server.service


sudo service rabbitmq-server status

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:

sudo systemctl enable rabbitmq-server

Step 3: 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:

sudo ufw disable

Step 4: Enable the RabbitMQ Management Dashboard (Optional)

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

sudo 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
tcp LISTEN 0 1024* uid:132 ino:1577718 sk:3d <->

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:

sudo rabbitmqctl add_user admin StrongPassword
sudo rabbitmqctl set_user_tags admin administrator

RabbitMQ User Management Commands

Delete User:

sudo rabbitmqctl delete_user user

Change User Password:

sudo rabbitmqctl change_password user strongpassword

Create new Virtualhost:

sudo rabbitmqctl add_vhost /my_vhost

List available Virtualhosts:

sudo rabbitmqctl list_vhosts

Delete a virtualhost:

sudo rabbitmqctl delete_vhost /myvhost

Grant user permissions for vhost:

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

List vhost permissions:

sudo rabbitmqctl list_permissions -p /myvhost

To list user permissions:

sudo rabbitmqctl list_user_permissions user

Delete user permissions:

sudo rabbitmqctl clear_permissions -p /myvhost user