Install Erlang & RabbitMQ on CentOS 7 | Fedora 35/34/33/32/31

Posted on 20 views

In this blog post, I’ll take you through the installation of Erlang & RabbitMQ on CentOS 7 | Fedora 35/34/33/32/31. RabbitMQ is an open source message broker software that implements the Advanced Message Queuing Protocol (AMQP). It receives messages from publishers (applications that publish them) and routes them to consumers (applications that process them).

In our previous guides, we covered:

Follow the steps below to install RabbitMQ on Fedora 35/34/33/32/31.

Step 1: Install Erlang on CentOS 7 | Fedora 35/34/33/32/31

Before installing RabbitMQ, you must install a supported version of Erlang/OTP.

Add YUM repository using bash script:

curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash

Or manually with the following command:

$ sudo vim /etc/yum.repos.d/rabbitmq_erlang.repo
[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

Update system YUM repositories:

sudo yum clean all
sudo yum makecache

Agree to import repository GPG key as requested:

rabbitmq_rabbitmq-server                                                                                                                                              9.5 kB/s | 3.9 kB     00:00
Importing GPG key 0x4D206F89:
 Userid     : "https://packagecloud.io/rabbitmq/rabbitmq-server (https://packagecloud.io/docs#gpg_signing) "
 Fingerprint: 8C69 5B02 19AF DEB0 4A05 8ED8 F4E7 8920 4D20 6F89
 From       : https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
Is this ok [y/N]: y
rabbitmq_rabbitmq-server                                                                                                                                               94 kB/s | 212 kB     00:02
rabbitmq_rabbitmq-server-source                                                                                                                                       260  B/s | 296  B     00:01
Metadata cache created.

Install Erlang on CentOS 7 / Fedora 35/34/33/32/31

sudo yum install erlang

Confirm installation by running the erl command:

$ erl
Erlang/OTP 23 [erts-11.2.2.4] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe]

Eshell V11.2.2.4  (abort with ^G)
1>
BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
       (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution
q

Step 2: Install RabbitMQ on CentOS 7 | Fedora 35/34/33/32/31

Add RabbitMQ Yum repository:

curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash

Manually adding the repository:

$ sudo vim /etc/yum.repos.d/rabbitmq_rabbitmq-server.repo
[rabbitmq_rabbitmq-server]
name=rabbitmq_rabbitmq-server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

The last step is the actual installation of RabbitMQ:

sudo yum install rabbitmq-server

Proceed with the installation ofRabbitMQ on CentOS 7 | Fedora 35/34/33/32/31

Dependencies resolved.
======================================================================================================================================================================================================
 Package                                         Architecture                           Version                                        Repository                                                Size
======================================================================================================================================================================================================
Installing:
 rabbitmq-server                                 noarch                                 3.9.5-1.el7                                    rabbitmq_rabbitmq-server                                  14 M
Installing dependencies:
 logrotate                                       x86_64                                 3.18.0-3.fc34                                  updates                                                   76 k

Transaction Summary
======================================================================================================================================================================================================
Install  2 Packages

Total download size: 14 M
Installed size: 19 M
Is this ok [y/N]: y

Confirm version of RabbitMQ installed:

$ rpm -qi rabbitmq-server
Name        : rabbitmq-server
Version     : 3.9.5
Release     : 1.el7
Architecture: noarch
Install Date: Fri 10 Sep 2021 03:39:59 PM UTC
Group       : Development/Libraries
Size        : 19698513
License     : MPLv2.0 and MIT and ASL 2.0 and BSD
Signature   : RSA/SHA512, Fri 27 Aug 2021 09:19:42 AM UTC, Key ID 6b73a36e6026dfca
Source RPM  : rabbitmq-server-3.9.5-1.el7.src.rpm
Build Date  : Fri 27 Aug 2021 09:19:40 AM UTC
Build Host  : 9e3c95bb-adfb-403d-5130-7997e4f9c96d
URL         : https://www.rabbitmq.com/
Summary     : The RabbitMQ server
Description :
RabbitMQ is an open source multi-protocol messaging broker.

Step 4: Start RabbitMQ Service

Now that you have RabbitMQ installed on your Fedora, start and enable the service to start on system boot:

sudo systemctl start rabbitmq-server
sudo systemctl enable rabbitmq-server

Confirm service status:

$ systemctl status  rabbitmq-server
 rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-09-10 18:44:34 UTC; 20s ago
 Main PID: 9373 (beam.smp)
   CGroup: /system.slice/rabbitmq-server.service
           ├─9373 /usr/lib64/erlang/erts-11.2.2.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 -sbwt...
           ├─9388 erl_child_setup 32768
           ├─9413 /usr/lib64/erlang/erts-11.2.2.5/bin/epmd -daemon
           ├─9436 inet_gethost 4
           └─9437 inet_gethost 4

Sep 10 18:44:31 centos rabbitmq-server[9373]: Doc guides:  https://rabbitmq.com/documentation.html
Sep 10 18:44:31 centos rabbitmq-server[9373]: Support:     https://rabbitmq.com/contact.html
Sep 10 18:44:31 centos rabbitmq-server[9373]: Tutorials:   https://rabbitmq.com/getstarted.html
Sep 10 18:44:31 centos rabbitmq-server[9373]: Monitoring:  https://rabbitmq.com/monitoring.html
Sep 10 18:44:31 centos rabbitmq-server[9373]: Logs: /var/log/rabbitmq/[email protected]
Sep 10 18:44:31 centos rabbitmq-server[9373]: /var/log/rabbitmq/[email protected]_upgrade.log
Sep 10 18:44:31 centos rabbitmq-server[9373]: 
Sep 10 18:44:31 centos rabbitmq-server[9373]: Config file(s): (none)
Sep 10 18:44:34 centos rabbitmq-server[9373]: Starting broker... completed with 0 plugins.
Sep 10 18:44:34 centos systemd[1]: Started RabbitMQ broker.

Step 5: Enable the RabbitMQ Management Dashboard (Optional)

You can optionally enable the RabbitMQ Management Web dashboard for easy management:

sudo rabbitmq-plugins enable rabbitmq_management

The Web service should be listening on TCP port 15672

$ sudo ss -tunelp | grep 15672
tcp   LISTEN  0       128                    0.0.0.0:15672        0.0.0.0:*      users:(("beam.smp",pid=9525,fd=71)) uid:111 ino:39934 sk:9 <->

If you have an active Firewalld service, allow ports 5672 and 15672:

sudo firewall-cmd --add-port=5672,15672/tcp --permanent
sudo firewall-cmd --reload

Access it by opening the Server IP or hostname port 15672.

install-rabbitmq-ubuntu-18.04-dashboard-min-1024x461

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 StrongPassword
sudo rabbitmqctl set_user_tags admin administrator

Login with this admin username and the password assigned.

install-rabbitmq-cluster-ubuntu-18.04-check-status-1024x305

RabbitMQ User Management Commands

Delete User:

rabbitmqctl delete_user user

Change User Password:

rabbitmqctl change_password user strongpassword

Create new Virtualhost:

rabbitmqctl add_vhost /my_vhost

List available Virtualhosts:

rabbitmqctl list_vhosts

Delete a virtualhost:

rabbitmqctl delete_vhost /myvhost

Grant user permissions for vhost:

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

List vhost permissions:

rabbitmqctl list_permissions -p /myvhost

To list user permissions:

rabbitmqctl list_user_permissions user

Delete user permissions:

rabbitmqctl clear_permissions -p /myvhost user

The next article to read is:

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.