In this guide we will explore how to install the latest release of RabbitMQ in Rocky Linux 8 server or Workstation. This will also work for RHEL 8 derivatives like Oracle linux, Alma linux and Centos 8.
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).
Related Content:
Prerequisites
To follow along, ensure you have the following
- An updated Rocky Linux/Centos 8 server
- Access to the internet
- Root access or user with Sudo access
Updating the system
Before proceeding, ensure that the server packages are up to date. Use this command to achieve that:
Adding PackageCloud Yum Repository
The RabbitMQ package is distributed via Yum repositories on PackageCloud. Install the PackageCloud Yum repository using this command:
1
| curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
|
This is the output on my server:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| $ curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
Detected operating system as rocky/8.
Checking for curl...
Detected curl...
Downloading repository file: https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/config_file.repo?os=rocky&dist=8&source=script
done.
Installing yum-utils...
rabbitmq_rabbitmq-server-source 1.4 kB/s | 819 B 00:00
rabbitmq_rabbitmq-server-source 23 kB/s | 3.9 kB 00:00
Importing GPG key 0x4D206F89:
Userid : "https://packagecloud.io/rabbitmq/rabbitmq-server (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>"
Fingerprint: 8C69 5B02 19AF DEB0 4A05 8ED8 F4E7 8920 4D20 6F89
From : https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
rabbitmq_rabbitmq-server-source 398 B/s | 296 B 00:00
Package yum-utils-4.0.18-4.el8.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
Generating yum cache for rabbitmq_rabbitmq-server...
Importing GPG key 0x4D206F89:
Userid : "https://packagecloud.io/rabbitmq/rabbitmq-server (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>"
Fingerprint: 8C69 5B02 19AF DEB0 4A05 8ED8 F4E7 8920 4D20 6F89
From : https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
Generating yum cache for rabbitmq_rabbitmq-server-source...
The repository is setup! You can now install packages.
|
Installing Erlang
RabbitMQ requires Erlang/OTP to run. The rabbitmq/erlang-rpm project provides a zero dependency 64-bit Erlang RPM package that provides just enough to run RabbitMQ. Get the latest from the releases here https://github.com/rabbitmq/erlang-rpm/releases.
1
| curl -LO -C - https://github.com/rabbitmq/erlang-rpm/releases/download/v24.1.4/erlang-24.1.4-1.el8.x86_64.rpm
|
Then install the downloaded file
1
| sudo dnf install ./erlang-24.1.4-1.el8.x86_64.rpm
|
This is the output on my server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| $ sudo dnf install ./erlang-24.1.4-1.el8.x86_64.rpm
rabbitmq_rabbitmq-server 1.3 kB/s | 833 B 00:00
rabbitmq_rabbitmq-server-source 1.6 kB/s | 819 B 00:00
Dependencies resolved.
=====================================================================================================
Package Architecture Version Repository Size
=====================================================================================================
Installing:
erlang x86_64 24.1.4-1.el8 @commandline 20 M
Transaction Summary
=====================================================================================================
Install 1 Package
Total size: 20 M
Installed size: 36 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : erlang-24.1.4-1.el8.x86_64 1/1
Running scriptlet: erlang-24.1.4-1.el8.x86_64 1/1
Verifying : erlang-24.1.4-1.el8.x86_64 1/1
Installed:
erlang-24.1.4-1.el8.x86_64
Complete!
|
Installing Rabbitmq
Once you have configured RabbitMQ repository, install RabbitMQ Server using the commands below.
1
| sudo dnf install -y rabbitmq-server
|
Package details can be queried using rpm
command with the option -qi
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| $ rpm -qi rabbitmq-server
Name : rabbitmq-server
Version : 3.9.9
Release : 1.el8
Architecture: noarch
Install Date: Thu 11 Nov 2021 07:00:01 PM UTC
Group : Development/Libraries
Size : 19373970
License : MPLv2.0 and MIT and ASL 2.0 and BSD
Signature : RSA/SHA512, Thu 11 Nov 2021 02:33:37 PM UTC, Key ID 6b73a36e6026dfca
Source RPM : rabbitmq-server-3.9.9-1.el8.src.rpm
Build Date : Thu 11 Nov 2021 02:33:35 PM UTC
Build Host : d4cd7bb3-d581-4bc0-6514-d4dc9ef3ea72
Relocations : (not relocatable)
URL : https://www.rabbitmq.com/
Summary : The RabbitMQ server
Description :
RabbitMQ is an open source multi-protocol messaging broker.
|
Starting and enabling rabbitmq-server service
Start the service
1
| sudo systemctl start rabbitmq-server
|
Then check the status to confirm its running
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| $ sudo systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2021-11-11 19:01:51 UTC; 28s ago
Main PID: 76165 (beam.smp)
Tasks: 24 (limit: 23167)
Memory: 95.7M
CGroup: /system.slice/rabbitmq-server.service
├─76165 /usr/lib64/erlang/erts-12.1.4/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>
├─76180 erl_child_setup 32768
├─76203 /usr/lib64/erlang/erts-12.1.4/bin/epmd -daemon
├─76224 inet_gethost 4
└─76225 inet_gethost 4
Nov 11 19:01:49 ip-10-2-40-72.us-west-2.compute.internal rabbitmq-server[76165]: Doc guides: https://rabbitmq.com/documentation.html
Nov 11 19:01:49 ip-10-2-40-72.us-west-2.compute.internal rabbitmq-server[76165]: Support: https://rabbitmq.com/contact.html
Nov 11 19:01:49 ip-10-2-40-72.us-west-2.compute.internal rabbitmq-server[76165]: Tutorials: https://rabbitmq.com/getstarted.html
Nov 11 19:01:49 ip-10-2-40-72.us-west-2.compute.internal rabbitmq-server[76165]: Monitoring: https://rabbitmq.com/monitoring.html
Nov 11 19:01:49 ip-10-2-40-72.us-west-2.compute.internal rabbitmq-server[76165]: Logs: /var/log/rabbitmq/rabbit@ip-10-2-40-72.log
Nov 11 19:01:49 ip-10-2-40-72.us-west-2.compute.internal rabbitmq-server[76165]: /var/log/rabbitmq/rabbit@ip-10-2-40-72_upgrade.log
Nov 11 19:01:49 ip-10-2-40-72.us-west-2.compute.internal rabbitmq-server[76165]: <stdout>
Nov 11 19:01:49 ip-10-2-40-72.us-west-2.compute.internal rabbitmq-server[76165]: Config file(s): (none)
Nov 11 19:01:51 ip-10-2-40-72.us-west-2.compute.internal rabbitmq-server[76165]: Starting broker... completed with 0 plugins.
Nov 11 19:01:51 ip-10-2-40-72.us-west-2.compute.internal systemd[1]: Started RabbitMQ broker.
|
Now you can enable it on boot
1
| sudo systemctl enable rabbitmq-server
|
You can get status of rabbitmq internals:
1
| $ sudo rabbitmqctl status
|
Optional: Enabling RabbitMQ Dashboard
Use the rabbitmq-plugins enable
command to enable the management dashboard:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| $ sudo rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@ip-10-2-40-72:
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-72...
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
1
2
3
| $ ss -tunlp | grep 15672
tcp LISTEN 0 128 0.0.0.0:15672 0.0.0.0:*
|
If you have an active Firewalld service, allow ports 5672
and 15672
1
2
| sudo firewall-cmd --add-port={5672,15672}/tcp --permanent
sudo firewall-cmd --reload
|
Access it by opening the URL <a href="https://computingforgeeks.com/" target="_blank" rel="noreferrer noopener">http://[server</a> 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:
1
2
3
4
5
6
7
| $ sudo rabbitmqctl add_user admin Sec3t
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 rabbitmq dashboard.
To use rabbitmqadmin
command line tool, copy it to your $PATH.
1
2
3
4
| sudo dnf install -y mlocate
sudo updatedb
sudo cp `locate rabbitmqadmin` /usr/local/bin/rabbitmqadmin
sudo chmod +x /usr/local/bin/rabbitmqadmin
|
You need to have python
installed and configured to run rabbitmqadmin. Use this command to ensure that python is installed:
1
| sudo dnf install -y python3
|
7. Basic RabbitMQ User Management Commands
Delete User:
1
| sudo rabbitmqctl delete_user user
|
Change User Password:
1
| sudo rabbitmqctl change_password user strongpassword
|
Create new Virtualhost:
1
| sudo rabbitmqctl add_vhost /my_vhost
|
List available Virtualhosts:
1
| sudo rabbitmqctl list_vhosts
|
Delete a virtualhost:
1
| sudo rabbitmqctl delete_vhost /myvhost
|
Grant user permissions for vhost:
1
| sudo rabbitmqctl set_permissions -p /myvhost user ".*" ".*" ".*"
|
List vhost permissions:
1
| sudo rabbitmqctl list_permissions -p /myvhost
|
To list user permissions:
1
| rabbitmqctl list_user_permissions user
|
Delete user permissions:
1
| rabbitmqctl clear_permissions -p /myvhost user
|
Conclusion
We have managed to install Rabbitmq in this guide