Linux系统安装RabbitMQ

本文主要讲解Linux系统安装rabbitmq服务

一、使用YUM存储库进行安装

1.导入签名密钥

bash 复制代码
## primary RabbitMQ signing key

rpm --import 'https://github.com/rabbitmq/signing-keys/releases/download/3.0/rabbitmq-release-signing-key.asc'

## modern Erlang repository

rpm --import 'https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.E495BB49CC4BBE5B.key'

## RabbitMQ server repository

rpm --import 'https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.9F4587F226208342.key'

2.导入YUM存储库

为了使用 Yum 存储库,必须在 /etc/yum.repos.d/ 目录下添加一个 .repo 文件(例如 rabbitmq.repo)。

说明:

如果系统是Linux 7 可以将下面的el8 修改成 el7,将 el/8 修改成 el/7

bash 复制代码
# In /etc/yum.repos.d/rabbitmq.repo



##

## Zero dependency Erlang RPM

##



[modern-erlang]

name=modern-erlang-el8

# Use a set of mirrors maintained by the RabbitMQ core team.

# The mirrors have significantly higher bandwidth quotas.

baseurl=https://yum1.rabbitmq.com/erlang/el/8/$basearch

        https://yum2.rabbitmq.com/erlang/el/8/$basearch

repo_gpgcheck=1

enabled=1

gpgkey=https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.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-el8-noarch

# Use a set of mirrors maintained by the RabbitMQ core team.

# The mirrors have significantly higher bandwidth quotas.

baseurl=https://yum1.rabbitmq.com/erlang/el/8/noarch

        https://yum2.rabbitmq.com/erlang/el/8/noarch

repo_gpgcheck=1

enabled=1

gpgkey=https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.E495BB49CC4BBE5B.key

       https://github.com/rabbitmq/signing-keys/releases/download/3.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-el8-source

# Use a set of mirrors maintained by the RabbitMQ core team.

# The mirrors have significantly higher bandwidth quotas.

baseurl=https://yum1.rabbitmq.com/erlang/el/8/SRPMS

        https://yum2.rabbitmq.com/erlang/el/8/SRPMS

repo_gpgcheck=1

enabled=1

gpgkey=https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.E495BB49CC4BBE5B.key

       https://github.com/rabbitmq/signing-keys/releases/download/3.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-el8]

name=rabbitmq-el8

baseurl=https://yum2.rabbitmq.com/rabbitmq/el/8/$basearch

        https://yum1.rabbitmq.com/rabbitmq/el/8/$basearch

repo_gpgcheck=1

enabled=1

# Cloudsmith's repository key and RabbitMQ package signing key

gpgkey=https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.9F4587F226208342.key

       https://github.com/rabbitmq/signing-keys/releases/download/3.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-el8-noarch]

name=rabbitmq-el8-noarch

baseurl=https://yum2.rabbitmq.com/rabbitmq/el/8/noarch

        https://yum1.rabbitmq.com/rabbitmq/el/8/noarch

repo_gpgcheck=1

enabled=1

# Cloudsmith's repository key and RabbitMQ package signing key

gpgkey=https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.9F4587F226208342.key

       https://github.com/rabbitmq/signing-keys/releases/download/3.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-el8-source]

name=rabbitmq-el8-source

baseurl=https://yum2.rabbitmq.com/rabbitmq/el/8/SRPMS

        https://yum1.rabbitmq.com/rabbitmq/el/8/SRPMS

repo_gpgcheck=1

enabled=1

gpgkey=https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.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.使用yum安装

bash 复制代码
#更新包元数据

yum update -y


#安装依赖

yum install -y logrotate


#安装erlang和rabbitmq

dnf install -y erlang rabbitmq-server

二、使用RPM安装包进行安装

1.导入签名

bash 复制代码
​rpm --import https://github.com/rabbitmq/signing-keys/releases/download/3.0/rabbitmq-release-signing-key.asc


​

2.安装erlang

bash 复制代码
curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash

sudo yum install erlang-26.1.2-1.el8.x86_64

3.下载rpm包

bash 复制代码
​wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.13.0/rabbitmq-server-3.13.0-1.el8.noarch.rpm

说明:如果是Linux 7系统将el8修改成el7

4.安装RabbitMQ

bash 复制代码
#在RabiitMQ安装过程中需要依赖socat插件,首先安装该插件

yum install -y socat

yum install -y rabbitmq-server-3.13.0-1.el8.noarch.rpm

三、常用命令

bash 复制代码
#开机自启动

systemctl enable rabbitmq-server


#启动服务

systemctl start rabbitmq-server


#启用web插件

rabbitmq-plugins enable rabbitmq_management


#使用rabbitmq_prometheus插件,3.8版本后已经内置此插件

#访问:localhost:15692/metrics

rabbitmq-plugins enable rabbitmq_prometheus


#启用mqtt插件,必须开启rabbitmq_management插件

rabbitmq-plugins enable rabbitmq_web_mqtt

四、添加用户

bash 复制代码
sudo rabbitmqctl add_user  admin  123456

sudo rabbitmqctl set_user_tags admin administrator

sudo rabbitmqctl  set_permissions -p / admin '.*' '.*' '.*'

sudo systemctl restart rabbitmq-server.service

五、登录验证

在浏览器输入网址http://localhost:1567,使用admin登录

相关推荐
啊哦1114 分钟前
配置防火墙和SELinux(1)
linux·服务器·网络
唐青枫9 分钟前
Linux 换行符的使用详解
linux
A charmer21 分钟前
【Linux】文件系统知识梳理:从磁盘硬件到文件管理
linux·运维·服务器
Cynthia的梦36 分钟前
Linux学习-Linux进程间通信(IPC)聊天程序实践指南
linux·运维·学习
卡戎-caryon43 分钟前
【Linux网络与网络编程】03.UDP Socket编程
linux·服务器·网络·笔记·单例模式·udp·网络通信
張萠飛1 小时前
Linux的TCP连接数到达2万,其中tcp_tw、tcp_alloc、tcp_inuse都很高,可能出现什么问题
linux·网络·tcp/ip
孙同学_1 小时前
【Linux篇】自主Shell命令行解释器
android·linux
敲上瘾2 小时前
高并发内存池(二):Central Cache的实现
linux·服务器·c++·缓存·哈希算法
一只努力学习的Cat.2 小时前
Linux:环境变量
linux
安顾里2 小时前
Linux命令-tar
linux·运维·服务器