
RabbitMQ is a robust, open-source message broker that allows efficient communication between distributed applications. RabbitMQ acts as an intermediary application between message producers and consumers. This message queuing architecture uses the Advanced Message Queuing Protocol, making it ideal for handling messaging in large-scale distributed systems. To get started, you can Install RabbitMQ on FreeBSD 13 for managing message queues effectively in your environment.
This article explains how to install RabbitMQ on FreeBSD 13.
Before you begin:
rabbitmq.example.com.RabbitMQ is available in the default package repositories on FreeBSD. The RabbitMQ package includes all dependencies, such as Erlang. Follow the steps below to install RabbitMQ using the default pkg package manager.
Update the server's package information index.
Install RabbitMQ.
Enable RabbitMQ to automatically start at boot.
Output:
Start the RabbitMQ service.
View the RabbitMQ service status and verify it's running.
Output:
RabbitMQ uses the rabbitmq_management and rabbitmqadmin plugins to enable CLI access and a web administration dashboard on the default TCP port 15672. Follow the steps below to enable the RabbitMQ management plugins, create an administrative user account, and grant the user full permissions to the application processes.
Enable the RabbitMQ management plugin.
Copy the /var/db/rabbitmq/.erlang.cookie file to /root/.erlang.cookie.
Enable the 400 permissions mode to grant the owner read privileges on the file.
Restart the RabbitMQ service.
Create a new RabbitMQ user and set a strong user password. Replace example_user with your desired username and example_password with a strong password:
Assign the user a specific role such as administrator.
Grant the user full privileges to the RabbitMQ processes.
In the above command:
.*: Grants the user configuration privileges..*: Grants the user write privileges to any resource..*: Grants the user read privileges to any resource.Download the rabbitmqadmin plugin binary to enable CLI access to the RabbitMQ.
Enable execute permissions on the file.
Move the rabbitmqadmin file to /usr/local/bin/.
Verify the installed rabbitmqadmin plugin version.
Output:
If you're looking for a different setup, you can also check out how to install RabbitMQ in Ubuntu to enhance your application’s message handling capabilities.
RabbitMQ creates a guest user with full administrative privileges by default. Disable the guest user and enable secure access to the RabbitMQ console with valid SSL certificates to enable encrypted HTTPS connections on the server. Follow the steps below to disable the default guest user, set up Nginx as a reverse proxy, and generate trusted Let's Encrypt SSL certificates.
Disable the RabbitMQ guest user.
Install Nginx.
Create a new /usr/local/etc/nginx/conf.d/ virtual host configuration directory.
Create a new RabbitMQ virtual host configuration using a text editor such as vim.
Add the following contents to the file. Replace rabbitmq.example.com with your actual domain.
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.
Open the main nginx.conf configuration file.
Add the following directive within the http block at the end of the file before the closing } mark.
Save and close the file.
The above configuration enables Nginx to read virtual configuration files in the /usr/local/etc/nginx/conf.d/ directory.
Test Nginx for configuration errors.
Output:
Enable Nginx to automatically start at boot.
Start the Nginx service.
Output:
Search the default package repositories to view the available Certbot package version.
Output:
Install the Certbort Let's Encrypt client tool and plugin for Nginx.
Generate a new SSL certificate for your RabbitMQ virtual host domain. Replace rabbitmq.example.com with your domain and hello@example.com with your active email address.
Output:
Verify that Certbot autorenews the SSL certificate upon expiry.
Output:
Restart Nginx to apply the changes.
Follow the steps below to access RabbitMQ, create a new queue, publish and retrieve messages.
Create a new RabbitMQ queue, such as testqueue using your administrative user. Replace example_user and example_password with the actual user and password you set earlier.
Output:
Publish a new message to the queue. For example, Greetings from Vultr.
Retrieve all messages in the queue.
Output:
Access your RabbitMQ domain using a web browser like Chrome to log in to the web administration console.
Log in using your RabbitMQ username and password to access the web console.
Find and expand the Nodes group to view your RabbitMQ node information.
Navigate to the Queues and Streams tab to manage the RabbitMQ queues on your server.
You have installed RabbitMQ on your FreeBSD 13 server, created a new administrative user, and enabled access to the web administration console. After you Install RabbitMQ on FreeBSD 13, RabbitMQ securely handles message exchanges between microservices and applications on your server. 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.