Linux-yum安装部署RabbitMQ

2023-12-16 04:54:10

一、简介

RabbitMQ一款知名的开源消息队列系统,为企业提供消息的发布、订阅、点对点传输等消息服务。

RabbitMQ在企业开发中十分常见,课程为大家演示快速搭建RabbitMQ环境。

二、安装

rabbitmq在yum仓库中的版本比较老,所以我们需要手动构建yum仓库

1、准备yum仓库

# root执行
# 1. 准备gpgkey密钥
rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
rpm --import https://packagecloud.io/rabbitmq/erlang/gpgkey
rpm --import https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey

# 2. 准备仓库文件
vim /etc/yum.repos.d/rabbitmq.repo
# 填入如下内容
##
## Zero dependency Erlang
##

[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

##
## RabbitMQ server
##

[rabbitmq_server]
name=rabbitmq_server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_server-source]
name=rabbitmq_server-source
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

2、安装RabbitMQ

# root执行
yum install erlang rabbitmq-server -y
Installed:
  erlang.x86_64 0:23.3.4.11-1.el7           rabbitmq-server.noarch 0:3.10.0-1.el7

3、启动

# root执行
# 使用systemctl管控,服务名:rabbitmq-server
systemctl enable rabbitmq-server		# 开机自启
systemctl disable rabbitmq-server		# 关闭开机自启
systemctl start rabbitmq-server			# 启动
systemctl stop rabbitmq-server			# 关闭
systemctl status rabbitmq-server		# 查看状态

4、放行防火墙,RabbitMQ使用5672、15672、25672 3个端口

# 方式1(推荐),关闭防火墙
systemctl stop firewalld		# 关闭
systemctl disable firewalld		# 关闭开机自启

# 方式2,放行5672 25672端口
firewall-cmd --add-port=5672/tcp --permanent		# 放行tcp规则下的5672端口,永久生效
firewall-cmd --add-port=15672/tcp --permanent		# 放行tcp规则下的15672端口,永久生效
firewall-cmd --add-port=25672/tcp --permanent		# 放行tcp规则下的25672端口,永久生效
firewall-cmd --reload								# 重新加载防火墙规则

5、启动RabbitMQ的WEB管理控制台

rabbitmq-plugins enable rabbitmq_management

6、添加admin用户,并赋予权限

rabbitmqctl add_user admin 'Itheima66^'
rabbitmqctl set_permissions -p "/" "admin" ".*" ".*" ".*"
rabbitmqctl set_user_tags admin administrator

7、浏览器打开管理控制台

http://192.168.88.130:15672

至此,RabbitMQ已经安装完成了。

文章来源:https://blog.csdn.net/m0_65372269/article/details/134933964
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。