CentOS-7下安装rabbitMQ-3.7.3

1.前言

1.1.编写目的

本文简述了如何在CentOS中实现安装abbitmq-server v3.7.3。

2.安装前的准备

2.1.安装必备工作

  • 安装工具
# yum install -y vim wget

" 修改host
# hostname
# vim /etc/hosts

" 在host中增加主机名解析,如:
127.0.0.1 my-pc localhost
  • ==【!】特别注意,一定一定要先清除原系统中的rabbitmq残余!!,否则安装会出现各种问题。==
# find / -name 'rabbitmq' | xargs rm -rf

2.2.修改软件源

# cd /etc/yum.repo.d/
# mv CentOS-Base.repo CentOS-Base.repo.bak

" 增加aliyun源
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

增加erlang源

# vim /etc/yum.repos.d/rabbitmq-erlang.repo

内容如下:

[rabbitmq-erlang]
name=rabbitmq-erlang
baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/7
gpgcheck=1
gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
repo_gpgcheck=0
enabled=1

2.3.下载rabbitmq-server-3.7.3

下载地址:https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.7.3

3.执行安装

3.1.安装rabbitmq-server-3.7.3

# cd /path/to/Downloads

# rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
# yum install -y rabbitmq-server-3.7.3-1.el7.noarch.rpm

【!】==注意,先关闭firewalld==

" 解除firewall自动启动
# systemctl disable firewalld

" 关闭firewalld
# systemctl disable firewalld

3.2.rabbitMQ 相关命令

" 开机启动
# systemctl enable rabbitmq-server.service

" 启动
# systemctl start rabbitmq-server.service

" 重启
# systemctl restart rabbitmq-server.service

" 关闭
# systemctl stop rabbitmq-server.service

3.3.开启web管理控制

# rabbitmq-plugins enable rabbitmq_management

3.4.web控制台

  • 访问地址:http://localhost:15672

  • ==【!】注意,默认rabbitmq的15672为localhost访问==,要开启远程访问,需要做如下处理:

# vim /etc/rabbitmq/rabbitmq.conf

" 加入以下内容 
loopback_users = none

参考:https://www.rabbitmq.com/access-control.html

4.常见问题

4.1.RabbitMQ 3.7.4及以版本

提示:==笔者亲测在CentOS 7上RabbitMQ 3.7.4,RabbitMQ 3.7.5无法安装成功。==

4.2.cookie权限问题

报错: [error] Error when reading /var/lib/rabbitmq/.erlang.cookie...

解决:

# chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie

5.参考

  • https://blog.csdn.net/liu_zhaoming/article/details/79386128
  • http://soft.dog/2016/01/13/rabbitmq-monitoring/
  • 阿里云源:https://mirrors.aliyun.com

你可能感兴趣的:(CentOS-7下安装rabbitMQ-3.7.3)