当前位置: 首页 > article >正文

在Ubuntu上使用apt工具安装RabbitMQ

创建安装脚本

cd home/

madir scripts

cd scripts

创建脚本前,需要确认Linux版本。不同的版本对应着不同的运行脚本。

lsb_release -a 查看Linux版本

可以看到,我的Ubuntu版本是22.04。

在这里找到对应的脚本复制。

创建脚本文件:

cat > RabbitMQ_install.sh

vim  RabbitMQ_install.sh

粘贴以下内容:

#!/bin/sh

sudo apt-get install curl gnupg apt-transport-https -y

## Team RabbitMQ's main signing key
curl -1sLf "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/com.rabbitmq.team.gpg > /dev/null
## Community mirror of Cloudsmith: modern Erlang repository
curl -1sLf https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.E495BB49CC4BBE5B.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg > /dev/null
## Community mirror of Cloudsmith: RabbitMQ repository
curl -1sLf https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.9F4587F226208342.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/rabbitmq.9F4587F226208342.gpg > /dev/null

## Add apt repositories maintained by Team RabbitMQ
sudo tee /etc/apt/sources.list.d/rabbitmq.list <<EOF
## Provides modern Erlang/OTP releases
##
deb [arch=amd64 signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa1.rabbitmq.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main
deb-src [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa1.rabbitmq.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main

# another mirror for redundancy
deb [arch=amd64 signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa2.rabbitmq.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main
deb-src [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa2.rabbitmq.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main

## Provides RabbitMQ
##
deb [arch=amd64 signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa1.rabbitmq.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main
deb-src [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa1.rabbitmq.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main

# another mirror for redundancy
deb [arch=amd64 signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa2.rabbitmq.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main
deb-src [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa2.rabbitmq.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main
EOF

## Update package indices
sudo apt-get update -y

## Install Erlang packages
sudo apt-get install -y erlang-base \
                        erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets \
                        erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key \
                        erlang-runtime-tools erlang-snmp erlang-ssl \
                        erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl

## Install rabbitmq-server and its dependencies
sudo apt-get install rabbitmq-server -y --fix-missing

Ctrl + d或:wq保存并退出

运行脚本

使文件可执行:

chmod u+x RabbitMQ_install.sh

执行脚本,安装开始进行:

bash RabbitMQ_install.sh

管理RabbitMQ

查看服务状态:

# check on service status as observed by service manager

sudo systemctl status rabbitmq-server

停止/启动RabbitMQ

# stop the local node

sudo systemctl stop rabbitmq-server

# start it back

sudo systemctl start rabbitmq-server

使用rabbitmq-diagnostics 工具查看一些状态:

# checks if the local node is running and CLI tools can successfully authenticate with it

sudo rabbitmq-diagnostics ping

# prints enabled components (applications), TCP listeners, memory usage breakdown, alarms

# and so on

sudo rabbitmq-diagnostics status

# prints cluster membership information

sudo rabbitmq-diagnostics cluster_status

# prints effective node configuration

sudo rabbitmq-diagnostics environment


http://www.kler.cn/a/290468.html

相关文章:

  • ODOO学习笔记(3):Odoo和Django的区别是什么?
  • LLMs之MindFormers:基于国产硬件华为Atlas针对GLM-4-9B实现模型全参微调(单机8卡)→模型推理(单卡多batch推理)
  • Spring Boot 核心配置文件
  • 云防护单节点2T抗攻击能力意味着什么?
  • Java项目实战II基于Spring Boot的药店管理系统的设计与实现(开发文档+数据库+源码)
  • 基于STM32的智能充电桩:集成RTOS、MQTT与SQLite的先进管理系统设计思路
  • 单链表的问题(2)
  • NCBI-get-GCFIDs_fast.py
  • 基于贝叶斯优化CNN-LSTM网络的数据分类识别算法matlab仿真
  • 戴尔科技领涨市场,AI服务器需求成关键驱动力
  • Error when attempting to add data source to Azure OpenAI api
  • uniapp css样式盒子上面的箭头样式
  • ElasticSearch学习笔记(四)分页、高亮、RestClient查询文档
  • 20240904日报
  • C#如何查看/写入日志到Windows事件查看器
  • c++学习笔记(5)
  • .gitignore 修改问题
  • 力扣151.反转字符串中的单词
  • 输电线路分布式故障诊断系统:分布式智慧网络的构建
  • c#笔记5 详解事件的内置类型EventHandler、windows事件在winform中的运用
  • 【IEEE出版 | 往届会后3个月EI检索】第三届IEEE云计算、大数据应用与软件工程国际学术会议 (IEEE-CBASE 2024,10月18-20)
  • 6 - Shell编程之sed与awk编辑器
  • 高级java每日一道面试题-2024年8月28日-框架篇[Spring篇]-你对Spring的事务管理了解多少?
  • Windows bat脚本学习七(从hex文件中获取bin大小)
  • centos 局域网 内部 时间同步 chrony
  • PHP7 的内核结构