一.erlang环境安装
erlang语言环境和RabbitMQ版本的对应关系如下:
https://www.rabbitmq.com/which-erlang.html
本次安装RabbitMQ 3.11.20 和 erlang 25.3.2.5
进入erlang官网下载
https://www.erlang.org/patches/otp-25.3.2.5
安装编译环境
yum install make gcc gcc-c++ build-essential openssl openssl-devel unixODBC unixODBC-devel kernel-devel m4 ncurses-devel -y
安装erlang语言环境
# 解压erlang安装包 tar xf otp-25.3.2.5.tar.gz # 新建一个erlang_25.3.2.5 mkdir /home/root/erlang_25.3.2.5 # 进入解压包目录 cd /home/root/otp-25.3.2.5 # 编译安装 把编译路径设置为新建的erlang文件夹 ./configure --prefix=/home/root/erlang_25.3.2.5 make && make install # 进入bin目录检查安装结果 cd /home/root/erlang_25.3.2.5/bin ./erl -version
出现如下结果说明erlang语言环境安装成功
[root@localhost bin]# ./erl -version Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 13.2.2.2
二.rabbitmq-server安装
#安装rabbitmq的另一个依赖 yum install -y socat
进官网下载通用unix包安装
https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.11.20
解压到/home/root/目录下
检测rabbitmq server 安装是否成功
cd /home/root/rabbitmq_server-3.11.20/sbin ./rabbitmqctl
输出如下内容说明成功
[root@localhost sbin]# ./rabbitmqctl Usage rabbitmqctl [--node <node>] [--timeout <timeout>] [--longnames] [--quiet] <command> [<command options>] Available commands: Help: autocomplete Provides command name autocomplete variants help Displays usage information for a command version Displays CLI tools version ...
三.配置环境变量
vi /etc/profile
在文件最后添加内容
#set erlang environment export ERLANG_HOME=/home/root/erlang_25.3.2.5 #set rabbitMq environment export RABBIT_HOME=/home/root/rabbitmq_server-3.11.20 #export PATH=${RABBIT_HOME}/sbin:$PATH PATH=${ERLANG_HOME}/bin:${RABBIT_HOME}/sbin:$PATH
刷新配置文件
source /etc/profile echo $PATH 查看是否成功添加环境变量
四.运行rabbitmq server 并添加账号密码
成功添加了环境变量后 ,可以直接通过 rabbitmq-server运行
[root@localhost ~]# rabbitmq-server 2023-08-27 17:57:37.934519+08:00 [notice] <0.44.0> Application syslog exited with reason: stopped 2023-08-27 17:57:37.938155+08:00 [notice] <0.229.0> Logging: switching to configured handler(s); following messages may not be visible in this log output ## ## RabbitMQ 3.11.20 ## ## ########## Copyright (c) 2007-2023 VMware, Inc. or its affiliates. ###### ## ########## Licensed under the MPL 2.0. Website: https://rabbitmq.com Erlang: 25.3.2.5 [emu] TLS Library: OpenSSL - OpenSSL 1.0.2k-fips 26 Jan 2017 Release series support status: supported Doc guides: https://rabbitmq.com/documentation.html Support: https://rabbitmq.com/contact.html Tutorials: https://rabbitmq.com/getstarted.html Monitoring: https://rabbitmq.com/monitoring.html Logs: /home/root/rabbitmq_server-3.11.20/var/log/rabbitmq/[email protected] /home/root/rabbitmq_server-3.11.20/var/log/rabbitmq/rabbit@localhost_upgrade.log <stdout> Config file(s): (none) Starting broker... completed with 3 plugins.
添加账号密码
rabbitmqctl add_user admin admin
设置admin为administrator角色
rabbitmqctl set_user_tags admin administrator
开启插件,包括开启浏览器的访问
rabbitmq-plugins enable rabbitmq_management
五.服务端口及浏览器访问
[root@localhost sbin]# ss -lntp State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* users:(("sshd",pid=1099,fd=3)) LISTEN 0 128 *:15672 *:* users:(("beam.smp",pid=46081,fd=34)) LISTEN 0 100 127.0.0.1:25 *:* users:(("master",pid=1379,fd=13)) LISTEN 0 128 *:25672 *:* users:(("beam.smp",pid=46081,fd=17)) LISTEN 0 128 *:4369 *:* users:(("epmd",pid=43554,fd=3)) LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=1099,fd=4)) LISTEN 0 100 [::1]:25 [::]:* users:(("master",pid=1379,fd=14)) LISTEN 0 128 [::]:5672 [::]:* users:(("beam.smp",pid=46081,fd=35)) LISTEN 0 128 [::]:4369 [::]:*
25672端口是 rabbitmq server 端口
15672端口 是浏览器入口
http://192.168.186.31:15672/
输入 admin admin访问
六.关闭防火墙
如果没法访问,就关闭防火墙
systemctl stop firewalld systemctl disable firewalld
标签:10,rabbitmq,server,centos7,RabbitMQ,home,erlang,root,2.5 From: https://www.cnblogs.com/chenzhi2023/p/17660583.html