centos7安装rabbitmq

centos7安装rabbitmq-3.7.17

准备

访问rabbitmq官网下载页面: https://www.rabbitmq.com/download.html

在这里插入图片描述

安装erlang

找到安装erlang: https://www.rabbitmq.com/install-rpm.html#install-from-esl-repository:

在这里插入图片描述
即:https://www.erlang-solutions.com/resources/download.html:

在这里插入图片描述
安装:

wget https://packages.erlang-solutions.com/erlang/rpm/centos/7/x86_64/esl-erlang_22.0.7-1~centos~7_amd64.rpm

rpm -ivh esl-erlang_22.0.7-1~centos~7_amd64.rpm
  • 安装过程中出现如下错误
error: Failed dependencies:

    libGL.so.1()(64bit) is needed by esl-erlang-19.3-1.x86_64

    libGLU.so.1()(64bit) is needed by esl-erlang-19.3-1.x86_64

    libodbc.so.2()(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_baseu-2.8.so.0()(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_baseu-2.8.so.0(WXU_2.8)(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_baseu_xml-2.8.so.0()(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_adv-2.8.so.0()(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_adv-2.8.so.0(WXU_2.8)(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_aui-2.8.so.0()(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_aui-2.8.so.0(WXU_2.8)(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_aui-2.8.so.0(WXU_2.8.5)(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_core-2.8.so.0()(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_core-2.8.so.0(WXU_2.8)(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_core-2.8.so.0(WXU_2.8.10)(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_gl-2.8.so.0()(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_gl-2.8.so.0(WXU_2.8)(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_html-2.8.so.0()(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_html-2.8.so.0(WXU_2.8)(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_stc-2.8.so.0()(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_stc-2.8.so.0(WXU_2.8)(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_xrc-2.8.so.0()(64bit) is needed by esl-erlang-19.3-1.x86_64

    libwx_gtk2u_xrc-2.8.so.0(WXU_2.8)(64bit) is needed by esl-erlang-19.3-1.x86_64

  • 解决方案:手动安装依赖
yum install epel-release        
yum install unixODBC unixODBC-devel wxBase wxGTK SDL wxGTK-gl

安装rabbitmq

https://www.rabbitmq.com/install-rpm.html#downloads:

在这里插入图片描述

wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.17/rabbitmq-server-3.7.17-1.el7.noarch.rpm

rpm -ivh rabbitmq-server-3.7.17-1.el7.noarch.rpm
## 可能需要先安装!!
yum install socat

启动rabbitmq

1.开机启动:

chkconfig rabbitmq-server on

2.查看启动状态:

rabbitmqctl status

3.启动,关闭,重启:

systemctl start rabbitmq-server.service
systemctl stop rabbitmq-server.service
systemctl restart rabbitmq-server.service
  • 启动遇到的问题

Job for rabbitmq-server.service failed because the control process exited with error code. See “systemctl status rabbitmq-server.service” and “journalctl -xe” for details.

journalctl -xe查看

unable to connect to epmd (port 4369) on wzy: address (cannot connect to host/port)

  • 是由于没改host,不能在wzy(主机名上运行)
  1. vi /ect/hosts
  2. 添加wzy这个域名的地址为127.0.0.1
    在这里插入图片描述

启动web管理台

rabbitmq-plugins enable rabbitmq_management

访问: http://192.168.93.129:15672,默认用户:guest/guest,但登陆时显示User can only log in via localhost!!!

解决方案

找到文件/usr/lib/rabbitmq/lib/rabbitmq_server-3.7.17/ebin/rabbit.app:

{loopback_users, [<<"guest">>]},

改为{loopback_users, []},

然后重启服务即可:

systemctl restart rabbitmq-server.service
  • 应用启动时的错误:需要创建用户并授权

centos7安装rabbitmq_第1张图片

  • 新建一个virtual hosts
  • 给mall用户授权

语法: set_permissions [-p ]

执行: rabbitmqctl set_permissions -p /mall mall “." ".” “.*”
完成对mall的授权,然后启动项目就正常了

你可能感兴趣的:(运维&linux相关)