How to install RabbitMQ in FreeBSD 13

In this guide we will explore how to install the latest release of RabbitMQ On a FreeBSD Server or Workstation

RabbitMQ is an open source message broker software that implements the Advanced Message Queuing Protocol (AMQP). RabbitMQ works by receiving messages from publishers (applications that publish them) and routes them to consumers (applications that process them).

Prerequisites

To follow along, ensure you have the following

  • An updated FreeBSD Server/workstation
  • Access to the internet
  • Root access or user with Sudo access

Table of Content

  1. Updating the system
  2. Installing Erlang
  3. Installing RabbitMQ
  4. Starting and enabling rabbitmq-server service
  5. Optional: Enabling RabbitMQ Dashboard
  6. Basic RabbitMQ User Management Commands

1. Updating the system

Before proceeding, ensure that the server packages are up to date. Use this command to achieve that:

pkg update
<meta charset="utf-8">pkg upgrade -y

2. Installing Erlang

The RabbitMQ package is found in the default FreeBSD repos. Install it using this command:

pkg install -y erlang

4. Installing Rabbitmq

RabbitMQ can be found in the default FreeBSD repos. Install using this command:

pkg install -y rabbitmq

This is the output on my server

# pkg install -y rabbitmq
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	erlang-runtime24: 24.1.1
	rabbitmq: 3.9.5

Number of packages to be installed: 2

The process will require 111 MiB more space.
49 MiB to be downloaded.
[1/2] Fetching rabbitmq-3.9.5.pkg: 100%   14 MiB  14.4MB/s    00:01
[2/2] Fetching erlang-runtime24-24.1.1.pkg: 100%   35 MiB  36.9MB/s    00:01
Checking integrity... done (0 conflicting)
[1/2] Installing erlang-runtime24-24.1.1...
[1/2] Extracting erlang-runtime24-24.1.1: 100%
[2/2] Installing rabbitmq-3.9.5...
===> Creating groups.
Creating group 'rabbitmq' with gid '135'.
===> Creating users
Creating user 'rabbitmq' with uid '135'.
===> Creating homedir(s)
[2/2] Extracting rabbitmq-3.9.5: 100%
=====
Message from erlang-runtime24-24.1.1:

--
To use this runtime port for development or testing, just prepend
its binary path ("/usr/local/lib/erlang24/bin") to your PATH variable.

Package details can be queried using apt-cache command with the option&nbsp;policy.

# pkg info rabbitmq
rabbitmq-3.9.5
Name           : rabbitmq
Version        : 3.9.5
Installed on   : Fri Nov 19 11:33:42 2021 UTC
Origin         : net/rabbitmq
Architecture   : FreeBSD:13:*
Prefix         : /usr/local
Categories     : net
Licenses       : MPL20
Maintainer     : erlang@FreeBSD.org
WWW            : http://www.rabbitmq.com/
Comment        : Erlang implementation of AMQP
Options        :
	ADMIN          : off
Annotations    :
	cpe            : cpe:2.3:a:pivotal_software:rabbitmq:3.9.5:::::freebsd13:x64
	repo_type      : binary
	repository     : FreeBSD
Flat size      : 20.6MiB
Description    :
RabbitMQ is a complete and highly reliable Enterprise Messaging
system. The RabbitMQ client libraries and broker daemon can be used
together to create an AMQP network, or used individually to bring
the benefits of RabbitMQ to established networks.

WWW: http://www.rabbitmq.com/

5. Starting and enabling rabbitmq-server service

Start rabbitmq

# service rabbitmq onestart
Starting rabbitmq.

Then check the status to confirm its running

service rabbitmq onestatus

Now you can enable it on boot

# sysrc rabbitmq_enable="YES"
rabbitmq_enable:  -> YES

You can get status of rabbitmq internals:

# rabbitmqctl status

6. Optional: Enabling RabbitMQ Dashboard

Use the rabbitmq-plugins enable command to enable the management dashboard:

# rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@freebsd:
rabbitmq_management
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@freebsd...
The following plugins have been enabled:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch

set 3 plugins.
Offline change; changes will take effect at broker restart.

You need to restart the service to apply the changes

# service rabbitmq restart
Stopping rabbitmq.
Starting rabbitmq.

The web service is up listening on port 15672

Access it by opening the URL <a href="https://computingforgeeks.com/" target="_blank" rel="noreferrer noopener">http://[server</a>&nbsp;IP]:15672 like http://127.0.0.1:15672

By default, the guest user exists and can connect only from localhost. You can log in with this user locally with the password “guest”

To be able to login on the network, create an admin user like below:

# rabbitmqctl add_user admin Secr3t
Adding user "admin" ...
Done. Don't forget to grant the user permissions to some virtual hosts! See 'rabbitmqctl help set_permissions' to learn more.

# rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...

Login with this admin username and the password assigned. You should see an interface similar to below:

citizix - Rabbitmq Dashboard

citizix – Rabbitmq Dashboard

7. Basic RabbitMQ User Management Commands

Delete User:

sudo rabbitmqctl delete_user user

Change User Password:

sudo rabbitmqctl change_password user strongpassword

Create new Virtualhost:

sudo rabbitmqctl add_vhost /my_vhost

List available Virtualhosts:

sudo rabbitmqctl list_vhosts

Delete a virtualhost:

sudo rabbitmqctl delete_vhost /myvhost

Grant user permissions for vhost:

sudo rabbitmqctl set_permissions -p /myvhost user ".*" ".*" ".*"

List vhost permissions:

sudo rabbitmqctl list_permissions -p /myvhost

To list user permissions:

rabbitmqctl list_user_permissions user

Delete user permissions:

rabbitmqctl clear_permissions -p /myvhost user

Conclusion

We have managed to install Rabbitmq in this guide.

comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy