
RabbitMQ is an open-source message broker that uses the Advanced Message Queuing Protocol (AMQP) to exchange messages between applications. RabbitMQ works as a distributed system that handles high-throughput workloads to efficiently improve applications' performance and stability.
In this article, you'll install RabbitMQ on Rocky Linux 9 and manage message queues on the server.
Before you begin:
rabbitmq.example.com.RabbitMQ is not available in the default package repositories on Rocky Linux 9. Follow the steps below to install the RabbitMQ repository information and dependency packages.
Import the RabbitMQ primary signing keys.
Import the Erlang signing keys.
Import the RabbitMQ server signing keys.
Create a new /etc/yum.repos.d/rabbitmq.repo RabbitMQ repository file using a text editor like nano.
Add the following contents to the file.
Save and close the file.
The above configuration enables access to the RabbitMQ and Erlang repositories for Rocky Linux 9.
Update the server's package information index to apply the new repository.
Install the socat and logrotate RabbitMQ dependency packages.
Install RabbitMQ and Erlang.
Enable the RabbitMQ service to automatically start at boot.
Start the RabbitMQ service.
View the RabbitMQ service status and verify it's running.
Output:
The RabbitMQ service is active and running on your server based on the active (running) message in the above output.
RabbitMQ uses a web console to manage application processes on the server. Follow the steps below to create a new RabbitMQ user, install rabbitmqadmin, and run the web console on the default port 15672.
Get the latest RabbitMQ server version and assign the value to a new LATEST_VERSION variable.
Download the latest rabbitmqadmin version from the RabbitMQ GitHub repository.
Set the execute permissions on the rabbitmqadmin binary.
Move the rabbitmqadmin binary to the /usr/local/bin directory to enable system-wide access to the tool.
Enable the RabbitMQ management plugin.
Create a new RabbitMQ user and set a strong password for the user. Replace exampleuser and strong_password with your desired user details.
Grant the user access privileges to the RabbitMQ console.
Assign the user to a specific role, such as administrator.
By default, RabbitMQ creates a guest user with full administrative privileges. Disable the user and enable secure access to the RabbitMQ console using valid SSL certificates to enable encrypted HTTPS connections. Follow the steps below to configure Nginx as a reverse proxy for RabbitMQ, disable the default guest user, and generate trusted Let's Encrypt SSL certificates to secure the RabbitMQ console.
Disable the RabbitMQ guest user.
Start the default firewalld utility.
Allow network connections to the HTTP port 80 through the firewall to enable Let's Encrypt validations.
Allow network connections to the HTTPS port 443 through the firewall.
Reload firewalld to apply the configuration changes.
Install Nginx.
Create a new virtual host for RabbitMQ. For example, rabbitmq.conf.
Add the following contents to the file. Replace rabbitmq.example.com with your domain name.
Save and close the file.
The above Nginx configuration creates a new reverse proxy connection to the RabbitMQ port 15672 and serves the web console using the rabbitmq.example.com domain on the HTTP port 80.
Test the Nginx configuration for errors.
Enable Nginx to connect to localhost ports through the default SELinux configuration.
Restart Nginx to apply the new changes.
Install the Certbot Let's Encrypt client tool and plugin for Nginx.
Generate a new SSL certificate for your virtual host domain. Replace rabbitmq.example.com with your domain and hello@example.com with your active email address.
Test the Certbot automatic SSL certificate renewal process.
Restart RabbitMQ to apply the new changes.
Follow the steps below to test access to the RabbitMQ CLI and web console on your server.
Create a new queue in RabbitMQ to store and manage messages.
Publish a new message to the queue.
Retrieve and view a message from the queue.
Output:
Access your domain using a web browser such as Chrome to manage queues using the RabbitMQ web console.
Enter the administrative user's details you created earlier and click Login to acccess the web console.
Expand the Nodes group to view your RabbitMQ node information.
Navigate to the Queues and Streams tab to manage RabbitMQ queues.
You have installed RabbitMQ on a Rocky Linux 9 and enabled access to the web console. RabbitMQ securely handles message exchanges between microservices. For more information and advanced configuration options, visit the RabbitMQ Documentation.
0 Comments
Be the first to comment and share your perspective with the community.