一、概要
1. 环境
(1) Rocky Linux 9.1
(2) Rabbit MQ 3.11.16
2. 安装方式
针对RHEL系统,Rabbit MQ官方介绍了两种安装方式:
(1) 通过Yum repositories安装,需要配置Yum repositories文件并设置Rabbit MQ镜像地址。这是官方强烈推荐的安装方式,也是本文选择的安装方式;
(2) 下载RPM包,手动安装Rabbit MQ及其依赖;
Rabbit MQ的RPM包的下载地址为:
https://github.com/rabbitmq/rabbitmq-server/releases
需要解决的依赖可参考:
https://www.rabbitmq.com/install-rpm.html#package-dependencies
二、安装与配置
1. 安装Signing Keys(签名密钥)
签名密钥用于校验软件包的签名,确保软件包的合法性。
## primary RabbitMQ signing key sudo rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc ## modern Erlang repository sudo rpm --import 'https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key' ## RabbitMQ server repository sudo rpm --import 'https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key'
2. 仓库文件
(1) 创建仓库文件
sudo vi /etc/yum.repos.d/rabbitmq.repo
(2) 初始化
# In /etc/yum.repos.d/rabbitmq.repo ## ## Zero dependency Erlang RPM ## [modern-erlang] name=modern-erlang-el9 # uses a Cloudsmith mirror @ yum1.novemberain.com. # Unlike Cloudsmith, it does not have traffic quotas baseurl=https://yum1.novemberain.com/erlang/el/9/$basearch repo_gpgcheck=1 enabled=1 gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key gpgcheck=1 sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 pkg_gpgcheck=1 autorefresh=1 type=rpm-md [modern-erlang-noarch] name=modern-erlang-el9-noarch # uses a Cloudsmith mirror @ yum1.novemberain.com. # Unlike Cloudsmith, it does not have traffic quotas baseurl=https://yum1.novemberain.com/erlang/el/9/noarch repo_gpgcheck=1 enabled=1 gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc gpgcheck=1 sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 pkg_gpgcheck=1 autorefresh=1 type=rpm-md [modern-erlang-source] name=modern-erlang-el9-source # uses a Cloudsmith mirror @ yum1.novemberain.com. # Unlike Cloudsmith, it does not have traffic quotas baseurl=https://yum1.novemberain.com/erlang/el/9/SRPMS repo_gpgcheck=1 enabled=1 gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc gpgcheck=1 sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 pkg_gpgcheck=1 autorefresh=1 ## ## RabbitMQ Server ## [rabbitmq-el9] name=rabbitmq-el9 baseurl=https://yum1.novemberain.com/rabbitmq/el/9/$basearch repo_gpgcheck=1 enabled=1 # Cloudsmith's repository key and RabbitMQ package signing key gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc gpgcheck=1 sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 pkg_gpgcheck=1 autorefresh=1 type=rpm-md [rabbitmq-el9-noarch] name=rabbitmq-el9-noarch baseurl=https://yum1.novemberain.com/rabbitmq/el/9/noarch repo_gpgcheck=1 enabled=1 # Cloudsmith's repository key and RabbitMQ package signing key gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc gpgcheck=1 sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 pkg_gpgcheck=1 autorefresh=1 type=rpm-md [rabbitmq-el9-source] name=rabbitmq-el9-source baseurl=https://yum1.novemberain.com/rabbitmq/el/9/SRPMS repo_gpgcheck=1 enabled=1 gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key gpgcheck=0 sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 pkg_gpgcheck=1 autorefresh=1 type=rpm-md
(3) 更新
sudo dnf update -y
3. 安装
(1) 安装依赖
sudo dnf install socat logrotate -y
sudo dnf install erlang-25.3.2 -y
(2) 校验Erlang
erl
(3) 安装Rabbit MQ
sudo dnf install -y rabbitmq-server
(4) 校验
sudo rabbitmqctl version
(5) 启动
sudo systemctl start rabbitmq-server sudo systemctl enable rabbitmq-server systemctl status rabbitmq-server
(6) 目录
默认情况下,安装之后Rabbit MQ的值如下:
a. 节点名称(node): rabbit@<hostname>
b. 安装目录(home dir): /var/lib/rabbitmq
c. 配置文件(config files): /etc/rabbitmq/rabbitmq.conf, /etc/rabbitmq/advanced.config
4. 管理员页面
(1) 开启管理员页面插件
sudo rabbitmq-plugins enable rabbitmq_management
(2) 重启
sudo systemctl restart rabbitmq-server
(3) 防火墙
sudo firewall-cmd --permanent --add-port=15672/tcp sudo firewall-cmd --reload
(4) 添加管理员
a. 添加管理员并设置密码
sudo rabbitmqctl add_user admin
b. 对管理员赋权
sudo rabbitmqctl set_user_tags admin administrator
c. 校验,列出所有的用户
sudo rabbitmqctl list_users
(5) 访问
http://<IP Address>:15672/
三、最佳实践
TBD
四、参考
1. 官方
https://www.rabbitmq.com/install-rpm.html
2. 其他
https://techviewleo.com/install-configure-rabbitmq-server-on-rocky/
标签:https,com,sudo,rabbitmq,RabbitMQ,key,Linux,gpgcheck,安装 From: https://www.cnblogs.com/eagle6688/p/17437095.html