How To Install RabbitMQ Server On Ubuntu 20.04 LTS

How to install RabbitMQ server on Ubuntu 20.04

On this short tutorial, we will learn how to install RabbitMQ server on Ubuntu 20.04 LTS operating system.

Introduction

RabbitMQ is an open source message broker software which implements the Advanced Message Queuing Protocol (AMQP) and Streaming Text Oriented Messaging Protocol and uses plugins to communicate with popular messaging solutions like MQTT (Message Queuing Telemetry Transport) and Streaming Text Oriented Messaging Protocol.

On this tutorial, we will learn how to install RabbitMQ server on Ubuntu 20.04 LTS operating system.

RabbitMQ Installation on Ubuntu 20.04 LTS

RabbitMQ installation will be consist of several steps as shown below :

  1. Install Erlang/OTP
  2. Add RabbitMQ Repository to Ubuntu
  3. Install RabbitMQ Server Ubuntu 20.04
  4. Enable the RabbitMQ Management Dashboard

Install Erlang

At this stage, we will install Erlang on Ubuntu 20.04. RabbitMQ requires Erlang to be installed first to run RabbitMQ smoothly. The Erlang installation on Ubuntu 20.04 has been discussed on How To Install Erlang on Ubuntu 20.04 LTS tutorial.

Add RabbitMQ Repository

Once Erlang has been installed on the system, we will add RabbitMQ repository to the system. To add RabbitMQ repository, we will do the following steps:

$ curl -fsSL https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc | sudo apt-key add -
$ sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list <<EOF
> deb https://dl.bintray.com/rabbitmq/debian bionic main
> EOF

Output will be as shown below :

ramans@otodiginet:~$ curl -fsSL https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc | sudo apt-key add -
[sudo] password for ramans: 
OK
ramans@otodiginet:~$ sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list <<EOF
> deb https://dl.bintray.com/rabbitmq/debian bionic main
> EOF
deb https://dl.bintray.com/rabbitmq/debian bionic main

Install RabbitMQ Server Ubuntu 20.04

After all are set, then we will install RabbitMQ on the system. To install RabbitMQ we will do the following commands line.

$ sudo apt-get update -y
$ sudo apt-get install rabbitmq-server -y --fix-missing

Output :

ramans@otodiginet:~$ sudo apt-get install rabbitmq-server -y --fix-missing
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  socat
The following NEW packages will be installed:
  rabbitmq-server socat
0 upgraded, 2 newly installed, 0 to remove and 329 not upgraded.
Need to get 15.7 MB of archives.
After this operation, 17.3 MB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu focal/main amd64 socat amd64 1.7.3.3-2 [323 kB]
Get:2 https://dl.bintray.com/rabbitmq/debian bionic/main amd64 rabbitmq-server all 3.8.9-1 [15.4 MB]
Fetched 15.7 MB in 38s (411 kB/s)                                                                                       
Selecting previously unselected package socat.
(Reading database ... 230632 files and directories currently installed.)
Preparing to unpack .../socat_1.7.3.3-2_amd64.deb ...
Unpacking socat (1.7.3.3-2) ...
Selecting previously unselected package rabbitmq-server.
Preparing to unpack .../rabbitmq-server_3.8.9-1_all.deb ...
Unpacking rabbitmq-server (3.8.9-1) ...
Setting up socat (1.7.3.3-2) ...
Setting up rabbitmq-server (3.8.9-1) ...
Adding group `rabbitmq' (GID 136) ...
Done.
Adding system user `rabbitmq' (UID 129) ...
Adding new user `rabbitmq' (UID 129) with group `rabbitmq' ...
Not creating home directory `/var/lib/rabbitmq'.
Created symlink /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service → /lib/systemd/system/rabbitmq-server.service.
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.1) ...

By default, RabbitMQ service is started and enabled to start on boot. To check the status of RabbitMQ we will do the following command line:

$ sudo systemctl status rabbitmq-server
$ sudo systemctl is-enabled rabbitmq-server.service

Output :

ramans@otodiginet:~$ sudo systemctl status rabbitmq-server 
● rabbitmq-server.service - RabbitMQ broker
     Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2020-12-04 19:56:15 PST; 5min ago
   Main PID: 29505 (beam.smp)
     Status: "Initialized"
      Tasks: 91 (limit: 9455)
     Memory: 101.3M
     CGroup: /system.slice/rabbitmq-server.service
             ├─29505 /usr/lib/erlang/erts-11.1/bin/beam.smp -W w -K true -A 64 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 51>
             ├─29623 erl_child_setup 32768
             ├─29653 /usr/lib/erlang/erts-11.1/bin/epmd -daemon
             ├─29680 inet_gethost 4
             └─29681 inet_gethost 4

Dec 04 19:56:09 otodiginet rabbitmq-server[29505]:   ##########  Licensed under the MPL 2.0. Website: https://rabbitmq.c>
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]:   Doc guides: https://rabbitmq.com/documentation.html
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]:   Support:    https://rabbitmq.com/contact.html
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]:   Tutorials:  https://rabbitmq.com/getstarted.html
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]:   Monitoring: https://rabbitmq.com/monitoring.html
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]:   Logs: /var/log/rabbitmq/rabbit@otodiginet.log
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]:         /var/log/rabbitmq/rabbit@otodiginet_upgrade.log
Dec 04 19:56:09 otodiginet rabbitmq-server[29505]:   Config file(s): (none)
Dec 04 19:56:15 otodiginet rabbitmq-server[29505]:   Starting broker... completed with 0 plugins.
Dec 04 19:56:15 otodiginet systemd[1]: Started RabbitMQ broker.
ramans@otodiginet:~$ sudo systemctl is-enabled rabbitmq-server.service 
[sudo] password for ramans: 
enabled

Enable RabbitMQ Management Web Dashboard

To simplify RabbitMQ management, we should activate RabbitMQ management web dashboard. To enable it, we will submit command line :

$ sudo rabbitmq-plugins enable rabbitmq_management

Output :

ramans@otodiginet:~$ sudo rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@otodiginet:
rabbitmq_management
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@otodiginet...
The following plugins have been enabled:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch

started 3 plugins.

The RabbitMQ web service will be listening on TCP port 15672, we will check it by following command line :

ramans@otodiginet:~$ ss -tunelp | grep 15672
tcp     LISTEN   0        1024             0.0.0.0:15672          0.0.0.0:*      uid:129 ino:712937 sk:d <->

The RabbitMQ management web dashboard will be servicing on http://<ipaddress>|hostname:15672.

RabbitMQ web management dashboard
RabbitMQ web management dashboard
RabbitMQ Management Dashboard front end
RabbitMQ Management Dashboard front end

Conclusion

We have discussed how to install RabbitMQ server on Ubuntu 20.04 LTS operating system. I hope this article will be helpful.

Frequently Asked Questions (FAQ)

1. What is RabbitMQ and what is it used for?

RabbitMQ is an open-source message broker that implements the AMQP (Advanced Message Queuing Protocol). It is commonly used to enable reliable communication between distributed applications, microservices, and system components.

2. Is RabbitMQ compatible with Ubuntu 20.04 LTS?

Yes. RabbitMQ fully supports Ubuntu 20.04 LTS (Focal Fossa) and runs well on Debian-based Linux distributions.

3. What are the prerequisites before installing RabbitMQ on Ubuntu 20.04?

RabbitMQ requires Erlang/OTP to be installed first, as it is built on the Erlang programming language. Make sure you install a compatible Erlang version before installing RabbitMQ.

4. How do I install RabbitMQ Server on Ubuntu 20.04 LTS?

The general installation steps are:

  1. Install Erlang/OTP
  2. Add the RabbitMQ official repository
  3. Update the package list
  4. Install the rabbitmq-server package
  5. Start and enable the RabbitMQ service

5. What is the RabbitMQ Management Plugin?

The RabbitMQ Management Plugin provides a web-based dashboard that allows you to monitor queues, exchanges, connections, and message rates. It runs on port 15672 and is highly recommended for administration and monitoring.

6. How can I check if RabbitMQ is running successfully?

You can verify the RabbitMQ service status using:

sudo systemctl status rabbitmq-server

If the status shows active (running), RabbitMQ is working correctly.

7. Do I need sudo or root access to install RabbitMQ?

Yes. Installing Erlang, adding repositories, and managing system services all require sudo or root privileges.

8. Which ports does RabbitMQ use by default?

By default:

  • 5672 – AMQP communication
  • 15672 – Management web UI (if enabled)
  • 25672 – Cluster communication

Make sure these ports are allowed in your firewall if needed.

9. Can RabbitMQ run with default settings after installation?

Yes. RabbitMQ works out-of-the-box with default configuration. However, for production environments, it is recommended to configure users, permissions, security settings, and optional TLS/SSL.

10. What should I do if RabbitMQ fails to start?

If RabbitMQ does not start:

  • Ensure Erlang is installed and compatible
  • Check the service logs using journalctl -u rabbitmq-server
  • Verify there are no port conflicts
  • Restart the service after fixing any issues

11. Is RabbitMQ suitable for production use?

Yes. RabbitMQ is widely used in production environments by many organizations. With proper configuration, monitoring, and security hardening, it is highly reliable and scalable.

(Visited 270 times, 1 visits today)

You may also like