RabbitMQ adalah perangkat lunak perantara pesan sumber terbuka yang mengimplementasikan Protokol Antrian Pesan Lanjutan (AMQP). RabbitMQ bekerja dengan menerima pesan dari penerbit (aplikasi yang menerbitkannya) dan mengarahkannya ke konsumen (aplikasi yang memprosesnya).
Konten Terkait
- Cara menginstal Erlang di Fedora 35
- Cara menginstal Erlang di Rocky Linux/Alma Linux/CentOS 8
- Cara Memasang dan Mengaktifkan Repositori EPEL di Rocky Linux/Centos 8
Prasyarat
Untuk mengikuti, pastikan Anda memiliki yang berikut
- Server Fedora 35 yang diperbarui
- Akses ke internet
- Akses root atau pengguna dengan akses Sudo
Daftar Isi
- Memperbarui sistem
- Menambahkan Repositori PackageCloud Yum
- Menginstal Erlang
- Menginstal RabbitMQ
- Memulai dan mengaktifkan layanan server rabbitmq
- Opsional:Mengaktifkan Dasbor RabbitMQ
- Perintah Manajemen Pengguna RabbitMQ Dasar
1. Memperbarui sistem
Sebelum melanjutkan, pastikan paket server sudah diperbarui. Gunakan perintah ini untuk mencapainya:
sudo dnf -y update
2. Menambahkan Repositori PackageCloud Yum
Paket RabbitMQ didistribusikan melalui repositori Yum di PackageCloud. Instal repositori PackageCloud Yum menggunakan perintah ini:
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
Ini adalah output di server saya:
$ curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
Detected operating system as fedora/34.
Checking for curl...
Detected curl...
Downloading repository file: https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/config_file.repo?os=fedora&dist=34&source=script
done.
Installing pygpgme to verify GPG signatures...
rabbitmq_erlang 3.2 kB/s | 951 B 00:00
rabbitmq_erlang-source 4.5 kB/s | 951 B 00:00
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) <[email protected]>"
Fingerprint: 8C69 5B02 19AF DEB0 4A05 8ED8 F4E7 8920 4D20 6F89
From : https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
rabbitmq_rabbitmq-server-source 393 B/s | 296 B 00:00
No match for argument: pygpgme
Error: Unable to find a match: pygpgme
WARNING:
The pygpgme package could not be installed. This means GPG verification is not possible for any RPM installed on your system.
To fix this, add a repository with pygpgme. Usualy, the EPEL repository for your system will have this.
More information: https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F
Installing yum-utils...
rabbitmq_rabbitmq-server-source 4.6 kB/s | 951 B 00:00
Package dnf-utils-4.0.24-1.fc34.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
WARNING:
The yum-utils package could not be installed. This means you may not be able to install source RPMs or use other yum features.
Generating yum cache for rabbitmq_rabbitmq-server...
Generating yum cache for rabbitmq_rabbitmq-server-source...
The repository is setup! You can now install packages.
3. Memasang Erlang
RabbitMQ membutuhkan Erlang/OTP untuk dijalankan. Proyek rabbitmq/erlang-rpm menyediakan paket Erlang RPM 64-bit dependensi nol yang menyediakan cukup untuk menjalankan RabbitMQ . Dapatkan yang terbaru dari rilis di sini https://github.com/rabbitmq/erlang-rpm/releases.
curl -LO -C - https://github.com/rabbitmq/erlang-rpm/releases/download/v24.1.4/erlang-24.1.4-1.el8.x86_64.rpm
Kemudian instal file yang diunduh
sudo dnf install ./erlang-24.1.4-1.el8.x86_64.rpm
Ini adalah output di server saya
$ 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!
4. Memasang Rabbitmq
Setelah Anda mengonfigurasi repositori RabbitMQ, instal Server RabbitMQ menggunakan perintah di bawah ini.
sudo dnf install -y rabbitmq-server
Detail paket dapat ditanyakan menggunakan rpm
perintah dengan opsi -qi
.
$ rpm -qi rabbitmq-server Name : rabbitmq-server Version : 3.8.23 Release : 1.fc34 Architecture: x86_64 Install Date: Fri 12 Nov 2021 07:14:47 PM UTC Group : Unspecified Size : 16503697 License : MPLv1.1 Signature : RSA/SHA256, Wed 20 Oct 2021 03:42:27 PM UTC, Key ID 1161ae6945719a39 Source RPM : rabbitmq-server-3.8.23-1.fc34.src.rpm Build Date : Wed 20 Oct 2021 03:16:35 PM UTC Build Host : buildvm-x86-11.iad2.fedoraproject.org Packager : Fedora Project Vendor : Fedora Project URL : https://www.rabbitmq.com/ Bug URL : https://bugz.fedoraproject.org/rabbitmq-server Summary : The RabbitMQ server Description : RabbitMQ is an implementation of AMQP, the emerging standard for high performance enterprise messaging. The RabbitMQ server is a robust and scalable implementation of an AMQP broker.
5. Memulai dan mengaktifkan layanan server rabbitmq
Mulai layanan
sudo systemctl start rabbitmq-server
Kemudian periksa statusnya untuk mengonfirmasi berjalannya
$ 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 Fri 2021-11-12 19:15:12 UTC; 2s ago
Main PID: 67336 (beam.smp)
Status: "Initialized"
Tasks: 23 (limit: 4603)
Memory: 93.1M
CPU: 7.581s
CGroup: /system.slice/rabbitmq-server.service
├─67336 /usr/lib64/erlang/erts-11.2.2.7/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 -sbw>
├─67345 erl_child_setup 1024
├─67387 inet_gethost 4
└─67388 inet_gethost 4
Nov 12 19:15:08 cloudsrv.citizix.com rabbitmq-server[67336]: TLS Library: OpenSSL - OpenSSL 1.1.1l FIPS 24 Aug 2021
Nov 12 19:15:08 cloudsrv.citizix.com rabbitmq-server[67336]: Doc guides: https://rabbitmq.com/documentation.html
Nov 12 19:15:08 cloudsrv.citizix.com rabbitmq-server[67336]: Support: https://rabbitmq.com/contact.html
Nov 12 19:15:08 cloudsrv.citizix.com rabbitmq-server[67336]: Tutorials: https://rabbitmq.com/getstarted.html
Nov 12 19:15:08 cloudsrv.citizix.com rabbitmq-server[67336]: Monitoring: https://rabbitmq.com/monitoring.html
Nov 12 19:15:08 cloudsrv.citizix.com rabbitmq-server[67336]: Logs: /var/log/rabbitmq/[email protected]
Nov 12 19:15:08 cloudsrv.citizix.com rabbitmq-server[67336]: /var/log/rabbitmq/[email protected]_upgrade.log
Nov 12 19:15:08 cloudsrv.citizix.com rabbitmq-server[67336]: Config file(s): /etc/rabbitmq/rabbitmq.conf
Nov 12 19:15:12 cloudsrv.citizix.com rabbitmq-server[67336]: Starting broker... completed with 0 plugins.
Nov 12 19:15:12 cloudsrv.citizix.com systemd[1]: Started RabbitMQ broker.
Sekarang Anda dapat mengaktifkannya saat boot
sudo systemctl enable rabbitmq-server
Anda bisa mendapatkan status internal rabbitmq:
$ sudo rabbitmqctl status
6. Opsional:Mengaktifkan Dasbor RabbitMQ
Gunakan rabbitmq-plugins enable
perintah untuk mengaktifkan dasbor manajemen:
$ sudo rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node [email protected]:
rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to [email protected]
The following plugins have been enabled:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
started 3 plugins.
Layanan web sedang mendengarkan pada port 15672
$ ss -tunlp | grep 15672
tcp LISTEN 0 128 0.0.0.0:15672 0.0.0.0:*
Jika Anda memiliki layanan Firewalld yang aktif, izinkan porta 5672
dan 15672
$ ss -tunlp | grep 15672
tcp LISTEN 0 1024 0.0.0.0:15672 0.0.0.0:*
Akses dengan membuka URL http://[server IP]:15672
seperti http://127.0.0.1:15672
Secara default, tamu pengguna ada dan hanya dapat terhubung dari localhost
. Anda dapat masuk dengan pengguna ini secara lokal dengan sandi “tamu”
Untuk bisa login di jaringan, buat user admin seperti di bawah ini:
$ 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] ...
Masuk dengan nama pengguna admin ini dan kata sandi yang diberikan. Anda akan melihat antarmuka yang mirip dengan di bawah ini:
Untuk menggunakan rabbitmqadmin
alat baris perintah, salin ke $PATH Anda.
sudo dnf install -y mlocate sudo updatedb sudo cp `locate rabbitmqadmin` /usr/local/bin/rabbitmqadmin sudo chmod +x /usr/local/bin/rabbitmqadmin
Anda harus memiliki python
diinstal dan dikonfigurasi untuk menjalankan rabbitmqadmin. Gunakan perintah ini untuk memastikan bahwa python telah diinstal:
sudo dnf install -y python3
7. Perintah Manajemen Pengguna RabbitMQ Dasar
Hapus Pengguna:
sudo rabbitmqctl delete_user user
Ubah Kata Sandi Pengguna:
sudo rabbitmqctl change_password user strongpassword
Buat Virtualhost baru:
sudo rabbitmqctl add_vhost /my_vhost
Daftar Virtualhost yang tersedia:
sudo rabbitmqctl list_vhosts
Hapus host virtual:
sudo rabbitmqctl delete_vhost /myvhost
Berikan izin pengguna untuk vhost:
sudo rabbitmqctl set_permissions -p /myvhost user ".*" ".*" ".*"
Daftar izin vhost:
sudo rabbitmqctl list_permissions -p /myvhost
Untuk membuat daftar izin pengguna:
rabbitmqctl list_user_permissions user
Hapus izin pengguna:
rabbitmqctl clear_permissions -p /myvhost user
Kesimpulan
Kami telah berhasil menginstal Rabbitmq dalam panduan ini