Install RabbitMQ Server on Ubuntu 23.10

Install RabbitMQ Server on Ubuntu 23.10

RabbitMQ is an open-source message broker software that offers communication between different applications or systems by implementing message queues. It acts as an intermediary for various components of a distributed system, enabling asynchronous communication and decoupling between producers of information and consumers of information. Additionally, it is compatible with Ubuntu OS, operating seamlessly within its environment, further enhancing its functionality and utility in such systems.

  1. Message Broker: RabbitMQ acts as a message broker, enabling communication between different components or services in a system. It receives, stores, and forwards messages from producers to consumers based on predefined rules and patterns.
  2. Message Queues: It uses queues to store messages temporarily. Producers send messages to queues, and consumers retrieve messages from these queues when they are ready to process them. This asynchronous communication allows decoupling between components and helps manage message flow.
  3. Protocols and Exchanges: RabbitMQ supports multiple messaging protocols such as AMQP (Advanced Message Queuing Protocol), MQTT, STOMP, and others. Messages are sent to exchanges, which route them to specific queues based on predefined rules (bindings).
  4. Reliability and Fault Tolerance: It offers features like message acknowledgments, durable queues, and clustering to ensure reliable message delivery and fault tolerance. Messages can be persisted even in case of server restarts or failures.
  5. Scalability and Flexibility: RabbitMQ’s architecture allows for horizontal scaling by deploying multiple nodes in a cluster. This scalability ensures high availability and better performance for handling increased message loads.
  6. Management and Monitoring: RabbitMQ provides a web-based management interface (RabbitMQ Management Plugin) for administration, monitoring, and configuration of the RabbitMQ server. It allows users to view queues, exchanges, connections, and manage users and permissions.

In today’s tutorial, we will learn to install and setup the RabbitMQ server on Ubuntu 23.10 with just a few simple steps.

Prerequisites

  • Linux based Server (Ubuntu 23.10).
  • Access of Root or Sudo user.

Also Read: How to Install or Update Latest OpenSSH on Ubuntu 23.10

Install RabbitMQ on Ubuntu 23.10

  • First, install some prerequisites packages on the server.
sudo apt-get install curl gnupg apt-transport-https -y
  • Add the repository signing keys for RabbitMQ’s main on with the following command.
curl -1sLf "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/com.rabbitmq.team.gpg > /dev/null
  • Add the repository signing keys for Cloudsmith: modern Erlang with the following command.
curl -1sLf https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.E495BB49CC4BBE5B.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg > /dev/null
  • Add the repository signing keys for Cloudsmith: RabbitMQ with the following command.
curl -1sLf https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.9F4587F226208342.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/rabbitmq.9F4587F226208342.gpg > /dev/null
  • Add the RabbitMQ official repository on Ubuntu 23.10
sudo tee /etc/apt/sources.list.d/rabbitmq.list <<EOF
## Provides modern Erlang/OTP releases
##
deb [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa1.novemberain.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main
deb-src [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa1.novemberain.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main

# another mirror for redundancy
deb [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa2.novemberain.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main
deb-src [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa2.novemberain.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main

## Provides RabbitMQ
##
deb [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa1.novemberain.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main
deb-src [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa1.novemberain.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main

# another mirror for redundancy
deb [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa2.novemberain.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main
deb-src [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa2.novemberain.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main
EOF
  • Update the server’s repository with the below commands.
sudo apt-get update -y
  • Install Erlang packages on the server
sudo apt-get install -y erlang-base erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key erlang-runtime-tools erlang-snmp erlang-ssl erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl
  • Install RabbitMQ-Server and its dependencies
sudo apt-get install rabbitmq-server -y --fix-missing
  • Start the RabbitMQ-Server with the following command.
sudo systemctl start rabbitmq-server

Enable RabbitMQ Management Dashboard

  • Enable the Management Plugin to setup the RabbitMQ Management Dashboard.
sudo rabbitmq-plugins enable rabbitmq_management
  • Run the following command with server_ip to access the RabbitMQ console.
http://server_ip:15672/
Rabbitmq-Server Dashboard
  • After Login, you will land on the RabbitMQ Dashboard.
RabbitMQ Dashboard

Manage the RabbitMQ service on Ubuntu

  • To start the service, run the following command.
sudo systemctl start rabbitmq-server
  • To check the status of the service.
sudo systemctl status rabbitmq-server
  • To stop the service, run the following command.
sudo systemctl stop rabbitmq-server
  • To enable the service, run the following command.
sudo systemctl enable rabbitmq-server

Create a User in RabbitMQ on Ubuntu

  • To create an admin user in RabbitMQ, we need to rabbitmqctl command line utility.
sudo rabbitmqctl add_user username password
  • Grant the admin privileges with the below commands
sudo rabbitmqctl set_user_tags username administrator
  • To verify list the users of RabbitMQ.
sudo rabbitmqctl list_users
  • To change the password of an existing user, then use the following command.
sudo rabbitmqctl change_password username new_password
  • To delete any user from RabbitMQ-Server
sudo rabbitmqctl delete_user username

Conclusion

RabbitMQ is a open-source message broker, fostering seamless communication between systems through queues and diverse protocols. Its reliability features, scalability, and intuitive management interface ensure robust, fault-tolerant messaging with enhanced performance and adaptability, consolidating its role as a vital component in distributed architectures. For details information of RabbitMQ, then click on here

If you guys have any queries or questions, then let me know in the comment section.