In this blog post, I’ll take you through the installation of Erlang & RabbitMQ on CentOS 7 | Fedora 38/37/36/35/34/33. 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).
Erlang is a programming language that was developed at Ericsson in the 1980s. It is designed to support the development of concurrent, distributed, and fault-tolerant systems. Erlang’s lightweight processes and message-passing model make it easy to build systems that can tolerate failures, such as the crash of a single node in a distributed system.
In our previous guides, we covered:
Follow the steps below to install RabbitMQ on Fedora.
Step 1: Install Erlang on CentOS 7 | Fedora
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) <[email protected]>"
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.
sudo yum install erlang
Confirm installation by running the erl
command:
$ erl
Erlang/OTP 25 [erts-13.1.3] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit:ns]
Eshell V13.1.3 (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
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
....
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.10.13
Release : 1.fc37
Architecture: x86_64
Install Date: Wed 25 Jan 2023 04:50:40 PM UTC
Group : Unspecified
Size : 22457597
License : MPLv1.1
Signature : RSA/SHA256, Tue 13 Dec 2022 09:17:47 PM UTC, Key ID f55ad3fb5323552a
Source RPM : rabbitmq-server-3.10.13-1.fc37.src.rpm
Build Date : Tue 13 Dec 2022 08:53:38 PM UTC
Build Host : buildvm-x86-12.iad2.fedoraproject.org
Packager : Fedora Project
Vendor : Fedora Project
....
Step 3: 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; preset: disabled)
Active: active (running) since Wed 2023-01-25 16:51:06 UTC; 5s ago
Main PID: 2700 (beam.smp)
Tasks: 24 (limit: 4536)
Memory: 120.5M
CPU: 7.124s
CGroup: /system.slice/rabbitmq-server.service
├─2700 /usr/lib64/erlang/erts-13.1.3/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 -sbwtdc>
├─2710 erl_child_setup 1024
├─2756 /usr/lib64/erlang/erts-13.1.3/bin/inet_gethost 4
├─2757 /usr/lib64/erlang/erts-13.1.3/bin/inet_gethost 4
└─2760 /bin/sh -s rabbit_disk_monitor
Jan 25 16:51:03 fedora.mylab.io rabbitmq-server[2700]: Doc guides: https://rabbitmq.com/documentation.html
Jan 25 16:51:03 fedora.mylab.io rabbitmq-server[2700]: Support: https://rabbitmq.com/contact.html
Jan 25 16:51:03 fedora.mylab.io rabbitmq-server[2700]: Tutorials: https://rabbitmq.com/getstarted.html
Jan 25 16:51:03 fedora.mylab.io rabbitmq-server[2700]: Monitoring: https://rabbitmq.com/monitoring.html
Jan 25 16:51:03 fedora.mylab.io rabbitmq-server[2700]: Logs: /var/log/rabbitmq/[email protected]
Jan 25 16:51:03 fedora.mylab.io rabbitmq-server[2700]: /var/log/rabbitmq/rabbit@fedora_upgrade.log
Jan 25 16:51:03 fedora.mylab.io rabbitmq-server[2700]: <stdout>
Jan 25 16:51:03 fedora.mylab.io rabbitmq-server[2700]: Config file(s): /etc/rabbitmq/rabbitmq.conf
Jan 25 16:51:06 fedora.mylab.io rabbitmq-server[2700]: Starting broker... completed with 0 plugins.
Jan 25 16:51:06 fedora.mylab.io systemd[1]: Started rabbitmq-server.service - RabbitMQ broker.
Step 4: Enable RabbitMQ 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.
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.
Step 5: 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: