Installing RabbitMQ on Ubuntu Server: A Step-by-Step Guide
RabbitMQ is a powerful and flexible open-source message broker that facilitates communication between different components of a distributed system. In this guide, we will walk through the process of installing RabbitMQ on an Ubuntu server. Follow these steps to set up RabbitMQ and manage users effectively.
Step 1: Install Erlang/OTP
Erlang is a programming language that RabbitMQ is built on. To install Erlang, run the following commands:
sudo apt update
sudo apt install curl software-properties-common apt-transport-https lsb-release
curl -1sLf 'https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/setup.deb.sh' | sudo -E bash
sudo apt update
sudo apt install erlang
Step 2: Install RabbitMQ
Now, let’s install RabbitMQ. Execute the following commands:
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.deb.sh | sudo bash
sudo apt update
sudo apt install rabbitmq-server
Step 3: Check RabbitMQ Status
Check if the RabbitMQ service is running and enabled:
systemctl status rabbitmq-server.service
systemctl is-enabled rabbitmq-server.service
Step 4: Enable RabbitMQ Management Plugin
Enable the RabbitMQ Management Plugin to access the web-based management interface:
sudo rabbitmq-plugins enable rabbitmq_management
Step 5: Open Ports for RabbitMQ
Allow traffic on ports 5672 and 15672:
sudo ufw allow proto tcp from any to any port 5672,15672
Step 6: Access the RabbitMQ Management Interface
Visit the RabbitMQ Management Interface in your web browser:
http://[server IP|Hostname]:15672
Step 7: RabbitMQ User Management
Create a new administrative user and set its password:
sudo rabbitmqctl add_user admin password
sudo rabbitmqctl set_user_tags admin administrator
Delete the default guest user (optional):
rabbitmqctl delete_user guest
Change the password for an existing user (e.g., “user”):
rabbitmqctl change_password user strongpassword
Congratulations! You have successfully installed RabbitMQ on your Ubuntu server and configured user management. You can now leverage RabbitMQ’s messaging capabilities for your applications.