在Linux部署RabbitMQ
时间: 2024-01-11 19:13:29 浏览: 260
Linux 环境部署RabbitMQ
好的,下面是在Linux上部署RabbitMQ的步骤:
1. 安装 Erlang
RabbitMQ 是使用 Erlang 语言编写的,因此需要先安装 Erlang。可以使用以下命令安装:
```
sudo apt-get update
sudo apt-get install erlang
```
2. 添加 RabbitMQ 的 APT 源
在 Ubuntu 上可以使用以下命令添加 RabbitMQ 的 APT 源:
```
echo "deb https://dl.bintray.com/rabbitmq/debian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list
```
3. 导入 RabbitMQ 的公钥
使用以下命令导入 RabbitMQ 的公钥:
```
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -
```
4. 安装 RabbitMQ
使用以下命令安装 RabbitMQ:
```
sudo apt-get update
sudo apt-get install rabbitmq-server
```
5. 启动 RabbitMQ
使用以下命令启动 RabbitMQ:
```
sudo service rabbitmq-server start
```
6. 验证 RabbitMQ 是否运行
使用以下命令验证 RabbitMQ 是否正在运行:
```
sudo rabbitmqctl status
```
如果输出类似于以下内容,则说明 RabbitMQ 正在运行:
```
Status of node rabbit@localhost ...
[{pid,14114},
{running_applications,[{rabbitmq_management,"RabbitMQ Management Console","3.7.16"},
{rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.7.16"},
{rabbitmq_management_agent,"RabbitMQ Management Agent","3.7.16"},
{rabbit,"RabbitMQ","3.7.16"},
{rabbit_common,[],"3.7.16"},
{cowboy,"Small, fast, modern HTTP server.","1.0.1"},
{amqp_client,"RabbitMQ AMQP Client","3.7.16"},
{rabbitmq_auth_backend_ldap,"RabbitMQ LDAP Authentication Backend","3.7.16"},
{rabbitmq_auth_mechanism_ssl,"RabbitMQ SSL Authentication Mechanism","3.7.16"},
{rabbitmq_auth_backend_cache,"RabbitMQ Caching Authentication Backend","3.7.16"},
{rabbitmq_web_mqtt,"RabbitMQ MQTT over WebSockets Transport","3.7.16"},
{rabbitmq_mqtt,"RabbitMQ MQTT Adapter","3.7.16"},
{mnesia,"MNESIA CXC 138 12","4.15.5"},
{os_mon,"CPO CXC 138 46","2.4.7"},
{rabbitmq_web_stomp,"RabbitMQ STOMP Web Transport","3.7.16"},
{rabbitmq_stomp,"RabbitMQ STOMP Adapter","3.7.16"},
{rabbitmq_peer_discovery_aws,"RabbitMQ AWS Peer Discovery Backend","3.7.16"},
{rabbitmq_peer_discovery_common,
"Peer Discovery Plug-In : Common","3.7.16"},
{rabbitmq_peer_discovery_k8s,
"Kubernetes Peer Discovery Backend","3.7.16"},
{rabbitmq_event_exchange,"RabbitMQ Event Exchange","3.7.16"},
{rabbitmq_tracing,"RabbitMQ Tracing","3.7.16"},
{rabbitmq_prometheus,"RabbitMQ Prometheus exporter","3.7.16"},
{prometheus,"Prometheus","4.2.1"},
{prometheus_httpd,"Prometheus httpd","2.0.0"},
{prome
```
到此为止,RabbitMQ 已成功安装并启动,可以开始使用了。
阅读全文