准备

1
yum install build-essential openssl openssl-devel unixODBC unixODBC-devel make gcc gcc-c++ kernel-devel m4 ncurses-devel tk tc xz -y

下载

1
2
3
wget www.rabbitmq.com/releases/erlang/erlang-18.3-1.el7.centos.x86_64.rpm 
wget http://repo.iotti.biz/CentOS/7/x86_64/socat-1.7.3.2-5.el7.lux.x86_64.rpm
wget www.rabbitmq.com/releases/rabbitmq-server/v3.6.5/rabbitmq-server-3.6.5-1.noarch.rpm

配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 修改hostname
vi /etc/hostname
------------------------ 结果 ------------------------
mq91
------------------------ 结果-end --------------------

# 修改hosts(配置集群时可以配置多个节点)
vi /etc/hosts
------------------------ 结果 ------------------------
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

172.18.195.91 mq91
172.18.195.92 mq92
172.18.195.93 mq93
------------------------ 结果-end --------------------

# 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld

软件安装

1
2
3
4
5
6
7
------------------------ 有顺序关系 ------------------------
# 安装erlang
rpm -ivh erlang-18.3-1.el7.centos.x86_64.rpm
# 安装socat
rpm -ivh socat-1.7.3.2-5.el7.lux.x86_64.rpm
# 安装rabbitmq
rpm -ivh rabbitmq-server-3.6.5-1.noarch.rpm

启用guest用户

1
2
3
4
# 修改配置文件rabbit.app
vi /usr/lib/rabbitmq/lib/rabbitmq_server-3.6.5/ebin/rabbit.app
# 比如修改密码、配置等等,例如:loopback_users中的<<”guest”>>,只保留guest,即:
{loopback_users, [<<"guest">>]} 改成:{loopback_users, [guest]}

启动服务

1
2
3
4
5
6
7
8
9
# 启动
rabbitmq-server start &
# 停止
rabbitmqctl stop_app

# 助力
ps -ef | grep rabbit
yum install lsof -y
lsof -i:5672

管理插件

1
2
3
4
# 查看所有插件
rabbitmq-plugins list
# 启动rabbitmq_management
rabbitmq-plugins enable rabbitmq_management

访问地址

1
2
3
# 访问rabbitmq管理后台
http://{你的linux服务器ip}:15672
# 使用用户名guest,密码guest登录