How to install and configure RabbitMQ in Archlinux

In this guide we will explore how to install the latest release of RabbitMQ in Archlinux system.

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 Archlinux machine
  • 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:

sudo pacman -Syyu

2. Installing Erlang

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

sudo pacman -S erlang

4. Installing Rabbitmq

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

sudo pacman -S rabbitmq

Package details can be queried using pacman command with the option -Qi.

$ sudo pacman -Qi rabbitmq
Name            : rabbitmq
Version         : 3.8.22-1
Description     : Highly reliable and performant enterprise messaging implementation of AMQP written in Erlang/OTP
Architecture    : any
URL             : https://rabbitmq.com
Licenses        : MPL
Groups          : None
Provides        : None
Depends On      : util-linux  inetutils  erlang-nox  socat
Optional Deps   : rabbitmqadmin: CLI management tool
                  logrotate: rotate log files
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 17.29 MiB
Packager        : Levente Polyak <anthraxx@archlinux.org>
Build Date      : Tue 07 Sep 2021 09:06:32 PM UTC
Install Date    : Sat 04 Dec 2021 03:57:11 PM UTC
Install Reason  : Explicitly installed
Install Script  : Yes
Validated By    : Signature

5. Starting and enabling rabbitmq-server service

Start the service

sudo systemctl start rabbitmq

Then check the status to confirm its running

$ sudo systemctl status rabbitmq
● rabbitmq.service - RabbitMQ broker
     Loaded: loaded (/usr/lib/systemd/system/rabbitmq.service; disabled; vendor preset: disabled)
     Active: active (running) since Sat 2021-12-04 15:58:46 UTC; 7s ago
   Main PID: 14398 (beam.smp)
     Status: "Initialized"
      Tasks: 24 (limit: 4606)
     Memory: 93.3M
     CGroup: /system.slice/rabbitmq.service
             ├─14398 /usr/lib/erlang/erts-12.1.5/bin/beam.smp -W w -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -sbwt none -sbwtdcpu >
             ├─14410 erl_child_setup 1024
             ├─14436 /usr/lib/erlang/erts-12.1.5/bin/epmd -daemon
             ├─14459 inet_gethost 4
             └─14460 inet_gethost 4

Dec 04 15:58:42 ip-10-2-40-103 rabbitmq[14398]:   TLS Library: OpenSSL - OpenSSL 1.1.1k  25 Mar 2021
Dec 04 15:58:42 ip-10-2-40-103 rabbitmq[14398]:   Doc guides:  https://rabbitmq.com/documentation.html
Dec 04 15:58:42 ip-10-2-40-103 rabbitmq[14398]:   Support:     https://rabbitmq.com/contact.html
Dec 04 15:58:42 ip-10-2-40-103 rabbitmq[14398]:   Tutorials:   https://rabbitmq.com/getstarted.html
Dec 04 15:58:42 ip-10-2-40-103 rabbitmq[14398]:   Monitoring:  https://rabbitmq.com/monitoring.html
Dec 04 15:58:42 ip-10-2-40-103 rabbitmq[14398]:   Logs: /var/log/rabbitmq/rabbit@ip-10-2-40-103.log
Dec 04 15:58:42 ip-10-2-40-103 rabbitmq[14398]:         /var/log/rabbitmq/rabbit@ip-10-2-40-103_upgrade.log
Dec 04 15:58:42 ip-10-2-40-103 rabbitmq[14398]:   Config file(s): (none)
Dec 04 15:58:45 ip-10-2-40-103 rabbitmq[14398]:   Starting broker... completed with 0 plugins.
Dec 04 15:58:46 ip-10-2-40-103 systemd[1]: Started RabbitMQ broker.

Now you can enable it on boot

sudo systemctl enable rabbitmq

You can get status of rabbitmq internals:

$ sudo rabbitmqctl status

6. Optional: Enabling RabbitMQ Dashboard

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

$ sudo rabbitmq-plugins enable rabbitmq_management
/usr/lib/erlang/erts-12.1.5/bin/beam.smp: /usr/lib/libncursesw.so.6: no version information available (required by /usr/lib/erlang/erts-12.1.5/bin/beam.smp)
Enabling plugins on node rabbit@ip-10-2-40-103:
rabbitmq_management
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@ip-10-2-40-103...
The following plugins have been enabled:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch

started 3 plugins.

The web service is up listening on port 15672

$ ss -tunlp | grep 15672
tcp   LISTEN 0      1024            0.0.0.0:15672      0.0.0.0:*

Access it by opening the URL http://[server_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:

$ sudo 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.

$ sudo 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