How to Install RabbitMQ on an Ubuntu 20.04 Cloud Server?

18-02-2024 02:44:39

RabbitMQ is an open-source message queuing software developed using the Erlang OTP language. It employs the AMQP (Advanced Message Queuing Protocol) and interacts with popular message queuing protocols through plugins, such as MQTT (Message Queuing Telemetry Transport) and STOMP (Streaming Text Oriented Messaging Protocol), among others. This article outlines the method for installing RabbitMQ on a cloud server.

First, install the necessary software packages.

$ sudo apt-get install wget apt-transport-https -y

Download the RabbitMQ signing key.

$ wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -

Set up the RabbitMQ software repository.

$ echo "deb https://dl.bintray.com/rabbitmq-erlang/debian focal erlang-22.x" | sudo tee /etc/apt/sources.list.d/rabbitmq.list

Install RabbitMQ.

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

Check the status of the RabbitMQ service.

$ sudo systemctl status rabbitmq-server

Enable the RabbitMQ Management Console, which conveniently controls RabbitMQ processes and behavior.

$ sudo rabbitmq-plugins enable rabbitmq_management

By default, the guest user can only log in via localhost, so it's necessary to create an administrative user to access the console and ensure the default password is changed to a more secure one.

$ sudo rabbitmqctl add_user admin SecurePassword
$ sudo rabbitmqctl set_user_tags admin administrator

After enabling the RabbitMQ Management Console plugin, you can access the console through the following URL in a browser: http://192.0.2.11:15672

With this, RabbitMQ is fully installed. The created administrative user has full management rights to RabbitMQ and can perform further settings on the RabbitMQ instance through the console.