如何在 Rocky Linux 9 上安装 RabbitMQ

Linux命令 Edge插件网 1年前 (2023-07-08) 607次浏览 已收录 0个评论

RabbitMQ 是一个功能强大且流行的开源消息代理,它使不同的系统能够相互通信。广泛应用于分布式系统、微服务架构等消息传递场景。

如何在 Rocky Linux 9 上安装 RabbitMQ

在 Rocky Linux 9 上安装 RabbitMQ

第 1 步。第一步是将系统更新到最新版本的软件包列表。为此,请运行以下命令:

<span class="pln">sudo dnf check</span><span class="pun">-</span><span class="pln">update</span>

第 2 步。正在安装 Erlang。

RabbitMQ 是使用 Erlang 编程语言构建的。要安装 RabbitMQ,我们首先需要安装 Erlang。运行以下命令以安装 Erlang 软件包:

<span class="pln">sudo dnf install erlang</span>

通过键入以下内容确认安装:

<span class="pln">erl </span><span class="pun">-</span><span class="pln">v</span>

第 3 步。在 Rocky Linux 9安装 RabbitMQ

RabbitMQ 提供了自己的软件包存储库,便于安装和更新。要添加 RabbitMQ 存储库,请运行以下命令:

<span class="pln">sudo tee </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">yum</span><span class="pun">.</span><span class="pln">repos</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">rabbitmq</span><span class="pun">.</span><span class="pln">repo </span><span class="pun"><<</span><span class="pln">EOF
</span><span class="pun">[</span><span class="pln">rabbitmq</span><span class="pun">]</span><span class="pln">
name</span><span class="pun">=</span><span class="pln">rabbitmq
baseurl</span><span class="pun">=</span><span class="pln">https</span><span class="pun">:</span><span class="com">//packagecloud.io/rabbitmq/rabbitmq-server/el/9/\$basearch</span><span class="pln">
enabled</span><span class="pun">=</span><span class="lit">1</span><span class="pln">
gpgcheck</span><span class="pun">=</span><span class="lit">1</span><span class="pln">
gpgkey</span><span class="pun">=</span><span class="pln">https</span><span class="pun">:</span><span class="com">//packagecloud.io/rabbitmq/rabbitmq-server/gpgkey</span><span class="pln">
repo_gpgcheck</span><span class="pun">=</span><span class="lit">1</span><span class="pln">
EOF</span>

保存文件并退出文本编辑器。

现在,让我们安装 RabbitMQ 服务器。执行以下命令安装 RabbitMQ

<span class="pln">sudo dnf install rabbitmq</span><span class="pun">-</span><span class="pln">server</span>

安装完成后,启用 RabbitMQ 服务以在系统引导时自动启动:

<span class="pln">sudo systemctl enable rabbitmq</span><span class="pun">-</span><span class="pln">server
sudo systemctl start rabbitmq</span><span class="pun">-</span><span class="pln">server</span>

第 4 步。设置用户帐户。

要访问 RabbitMQ 管理界面,您需要设置具有适当权限的用户帐户:

<span class="pln">sudo rabbitmqctl add_user </span><span class="str"><username></span> <span class="str"><password></span>

将 替换为所需的值。<username><password>

向用户授予管理权限:

<span class="pln">sudo rabbitmqctl set_user_tags </span><span class="str"><username></span><span class="pln"> administrator</span>

最后,为管理用户设置权限:

<span class="pln">sudo rabbitmqctl set_permissions </span><span class="pun">-</span><span class="pln">p </span><span class="pun">/</span> <span class="str"><username></span> <span class="str">".*"</span> <span class="str">".*"</span> <span class="str">".*"</span>

Step 5. Configuring Firewall.

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

<span class="pln">sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">permanent </span><span class="pun">--</span><span class="kwd">add</span><span class="pun">-</span><span class="pln">port</span><span class="pun">={</span><span class="lit">4369</span><span class="pun">,</span><span class="lit">5672</span><span class="pun">,</span><span class="lit">15672</span><span class="pun">,</span><span class="lit">25672</span><span class="pun">}/</span><span class="pln">tcp
sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">reload</span>

第 6 步。访问 RabbitMQ Web 界面。

成功安装后,打开您的 Web 浏览器并访问 。您应该会看到 RabbitMQ 登录页面:http://your-ip-address:15672/

如何在 Rocky Linux 9 上安装 RabbitMQ

感谢您使用本教程在您的 Rocky Linux 9 系统上安装 RabbitMQ。如需其他帮助或有用信息,我们建议您查看 RabbitMQ 官方网站


Edge插件网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:如何在 Rocky Linux 9 上安装 RabbitMQ
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址