Skip to main content

Installing RabbitMQ on Ubuntu: A Comprehensive Guide

Introduction

RabbitMQ is an open-source message broker software, often used for handling asynchronous messaging with high throughput and reliability. Installing RabbitMQ on Ubuntu involves setting up Erlang (a dependency for RabbitMQ) and then installing RabbitMQ itself. This guide provides detailed steps for installing RabbitMQ on an Ubuntu system.

Svix is the enterprise ready webhooks sending service. With Svix, you can build a secure, reliable, and scalable webhook platform in minutes. Looking to send webhooks? Give it a try!

Use Case: Server Environment

This guide is tailored for system administrators or developers looking to set up RabbitMQ on an Ubuntu server, whether for a production environment or a development/test environment.

Step-by-Step Guide with Code Samples

Prerequisites

  • An Ubuntu server (18.04 LTS or later is recommended).
  • Sudo privileges on the server.

Step 1: Update Ubuntu Packages

  1. Update the package list:

    sudo apt update
  2. Upgrade the packages (optional but recommended):

sudo apt upgrade

Step 2: Install Erlang

RabbitMQ requires Erlang to be installed. Install Erlang using the Erlang Solutions repository.

  1. Add the Erlang Solutions repository:
wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo apt-key add -
echo "deb https://packages.erlang-solutions.com/ubuntu $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/erlang.list
  1. Update the package list:
sudo apt update
  1. Install Erlang:
sudo apt install erlang

Step 3: Install RabbitMQ

  1. Add the RabbitMQ repository to your system:
echo "deb https://dl.bintray.com/rabbitmq-erlang/debian $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/rabbitmq.list
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -
  1. Update the package list again:
sudo apt update
  1. Install RabbitMQ server:
sudo apt install rabbitmq-server

Step 4: Manage RabbitMQ Service

  1. Start the RabbitMQ service:
sudo systemctl start rabbitmq-server
  1. Enable RabbitMQ service to start on boot:
sudo systemctl enable rabbitmq-server
  1. Check the status of the RabbitMQ service:
sudo systemctl status rabbitmq-server

Step 5: Enable and Access the RabbitMQ Management Console

  1. Enable the RabbitMQ management console:
sudo rabbitmq-plugins enable rabbitmq_management
  1. Access the management console:
  • The management console can be accessed via http://[Your_Server_IP]:15672/.
  • The default username and password are both guest.

Conclusion

You have now successfully installed RabbitMQ on your Ubuntu server. This setup is suitable for both development and production environments. Remember to configure firewalls and security settings as per your organization's policies when deploying in a production environment.

For more advanced configurations, such as clustering and high availability setups, refer to the official RabbitMQ documentation and tailor the setup according to your specific requirements.