Centos7 安装 Rabbit mq
概述
本文介绍如何在centos7 安装rabbit mq。 rabbit mq的版本为最新版本(3.7.14)
安装Erlang
rabbit mq依赖于erlang,所以需要先安装erlang,并且rabbit mq不同版本对erlang的版本要求也不一样。
这里使用rabbit mq提供的erlang的包进行安装erlang
- 添加镜像
vim /etc/yum.repos.d/rabbitmq_erlang.repo
[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
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
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- 安装
yum install erlang
1
- 验证是否安装成功
[xiaoj@localhost ~]$ erl
1
安装rabbit mq
- 下载rpm
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.14/rabbitmq-server-3.7.14-1.el7.noarch.rpm
1
2
2
- 导入密钥
sudo rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
1
2
2
- 安装
sudo yum install rabbitmq-server-3.7.14-1.el7.noarch.rpm
1
启动
- 设置守护进程,系统启动时执行
sudo chkconfig rabbitmq-server on
1
- 启动
sudo /sbin/service rabbitmq-server start
1
- 停止
sudo /sbin/service rabbitmq-server stop
1
安装管理界面
- 启用rabbitmq_management
# 启用rabbitmq_management
sudo rabbitmq-plugins enable rabbitmq_management
#重启rabbit mq
sudo /sbin/service rabbitmq-server restart
# 查看http服务开启,端口15672
sudo rabbitmqctl status | grep listeners
1
2
3
4
5
6
2
3
4
5
6
创建用户及授权
# 查看已经存在的用户
sudo rabbitmqctl list_users
# 新建用户
sudo rabbitmqctl add_user admin admin
# 授权
sudo rabbitmqctl set_user_tags admin administrator
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10