
RabbitMQ is a popular, lightweight, open-source message broker that implements the Advanced Message Queuing Protocol (AMQP). It enables applications to exchange messages asynchronously, decouple them from each other and improve scalability.
This article explains how to install RabbitMQ on Debian 12.
Before you begin:
rabbitmq.example.com.Erlang is a RabbitMQ dependency package required on a server. asdf is a CLI tool that can manage language runtime versions on a per-project basis and enables the smooth installation of Erlang. Follow the steps below to enable all dependency packages and install RabbitMQ on your server.
Install all required asdf dependencies.
Download asdf using the official project repository.
Open the .bashrc file in your environment.
Add the following directives at the end of the file.
Save and lose the file.
Reload the .bashrc file in your session.
View the asdf version on your server.
Output:
Install the asdf-erlang plugin.
Install all necessary Erlang dependencies.
Create a new environment variable to skip Java dependency warnings during installation.
Install the Erlang version 26.1.2
Set the global Erlang version to use on the server.
Access the Erlang shell to verify your installation.
Output:
Enter A and press Enter to exit the Erlang shell.
Install RabbitMQ.
The above command installs the latest version of RabbitMQ server package and fixes any broken dependencies on your server.
View the RabbitMQ service status and verify that it's running.
Output:
Enable the RabbitMQ service to automatically start at system boot.
Start the RabbitMQ service.
Follow the steps below to configure RabbitMQ on your server.
List all RabbitMQ virtual hosts.
Create a new RabbitMQ virtual host to use in your applications. Replace myhost with your desired virtual host.
Create a new RabbitMQ user and assign the user a strong password.
Grant the user administrative privileges to use RabbitMQ.
Grant the user full permissions to all RabbitMQ virtual hosts, exchanges, queues, bindings, and routing keys.
Follow the steps below to disable the guest user and secure the RabbitMQ web management console with trusted SSL certificates on your server.
Disable the RabbitMQ guest user profile.
Open the main RabbitMQ configuration file to enable user authentication.
Add the following directive at the end of the file.
Save and close the file.
Restart RabbitMQ to apply changes.
Install the Nginx web server to work as a reverse proxy with RabbitMQ.
Create a new Nginx virtual host configuration for RabbitMQ.
Add the following configurations to the file. Replace rabbitmq.example.com with your actual domain.
Save and close the file.
The above Nginx configuration listens for incoming network connections on the HTTP port 80 to serve the RabbitMQ console from port 15672 and the /mqtt path for web socket connections.
Disable the default virtual host configuration.
Create a new symbolic link to the /sites-enabled directory to enable the virtual host configuration.
Test the Nginx configuration for errors.
Output:
Restart the Nginx service.
Install the Certbot Let's Encrypt client plugin for Nginx.
Allow network connections on the HTTP port 80 through the firewall to enable Let's Encrypt validations.
Restart UFW to apply changes.
Generate a new SSL certificate to use with your Nginx virtual host and RabbitMQ domain rabbitmq.example.com. Replace hello@example.com with your actual email.
Your output should be similar to the one below when successful.
Restart Nginx to apply the SSL configuration changes.
Allow HTTPS connections on port 443 through the firewall.
Restart UFW to apply changes.
You can access the RabbitMQ console to monitor and manage your server functionalities. Follow the steps below to enable the RabbitMQ management plugin, and access the web administration console to perform tasks such as queue monitoring.
Enable the RabbitMQ management plugin.
Output:
View all RabbitMQ plugins and verify that the management plugin is active.
Output:
Based on the above output, the web administration management plugin is enabled based on the [E] prompt.
Access your RabbitMQ domain using a web browser such as Chrome to access the web administration console.
Enter your administrative RabbitMQ user and password details you created earlier to log in to the console.
Use the RabbitMQ management interface to view active nodes, users, virtual hosts, queues, exchanges, and perform management tasks on the server.
You have installed RabbitMQ on a Debian 12 server and secured access to the web administration console. RabbitMQ implements message-based architectures, microservices, and distributed systems you can use with existing applications on your server. For more information and configuration options, visit the RabbitMQ documentation.
0 Comments
Be the first to comment and share your perspective with the community.