编译安装rabbitmq
因为没有root权限,无法使用yum方式安装,因此尝试使用源码编译安装
因为erlang版本和rabbitmq版本有对应关系,我们首先进行版本确认https://www.rabbitmq.com/docs/which-erlang
我们安装的版本为:erlang-23.3.4.11、rabbitmq-server-3.10.0
1 下载源码
https://github.com/erlang/otp/tree/OTP-23.3.4.11
https://github.com/rabbitmq/rabbitmq-server/tree/v3.10.0
将下载的源码放到路径下/xxxx/AIS/ais_java/mq/mq-source
解压(解压和安装都比较耗时)

2 erlang安装
创建/xxxx/ais_java/mq/erlang路径,进入到解压路径下执行
$ ./configure --prefix=/xxxx/ais_java/mq/erlang --with-ssl --enable-threads --enable-smp-support --enable-kernel-poll --enable-hipe --without-javac $ make && make install
上述过程大约要几十分钟

修改环境变量vi ~/.bashrc
export JAVA_HOME=/xxxx/ais_java/jdk1.8.0_251 export ERLANG_HOME=/xxxx/ais_java/mq/erlang export PATH=${ERLANG_HOME}/bin:$PATH
$ source ~/.bashrc $ erl -version Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 11.2.2.10
安装完成
3 rabbitmq安装
首先修改安装目录
$ cd /xxxx/ais_java/mq/mq-source/rabbitmq-server-3.10.0 $ vi Makefile
修改PREFIX为如下路径

安装
$ make && make install
如果遇到下面报错,说明安装失败了

那么我们使用官方为我们编译好的版本,不需要手动编译了
下载,解压,启动
P_bc_qsub 17:49:12 /ifswh4/BC_PUB_T1/Pipeline/AIS/ais_java/mq JY $ tar -xf rabbitmq-server-generic-unix-3.10.0.tar.xz $ cd rabbitmq_server-3.10.0/ $ ./sbin/rabbitmq-server 2025-04-29 17:52:39.630059+08:00 [info] <0.221.0> Feature flags: list of feature flags found: 2025-04-29 17:52:39.703422+08:00 [info] <0.221.0> Feature flags: [ ] classic_mirrored_queue_version 2025-04-29 17:52:39.703588+08:00 [info] <0.221.0> Feature flags: [ ] implicit_default_bindings 2025-04-29 17:52:39.703694+08:00 [info] <0.221.0> Feature flags: [ ] maintenance_mode_status 2025-04-29 17:52:39.703860+08:00 [info] <0.221.0> Feature flags: [ ] quorum_queue 2025-04-29 17:52:39.703999+08:00 [info] <0.221.0> Feature flags: [ ] stream_queue 2025-04-29 17:52:39.704121+08:00 [info] <0.221.0> Feature flags: [ ] user_limits 2025-04-29 17:52:39.704227+08:00 [info] <0.221.0> Feature flags: [ ] virtual_host_metadata 2025-04-29 17:52:39.704374+08:00 [info] <0.221.0> Feature flags: feature flag states written to disk: yes 2025-04-29 17:52:42.054377+08:00 [noti] <0.44.0> Application syslog exited with reason: stopped 2025-04-29 17:52:42.054612+08:00 [noti] <0.221.0> Logging: switching to configured handler(s); following messages may not be visible in this log output ## ## RabbitMQ 3.10.0 ## ## ########## Copyright (c) 2007-2022 VMware, Inc. or its affiliates. ###### ## ########## Licensed under the MPL 2.0. Website: https://rabbitmq.com Erlang: 23.3.4.11 [emu] TLS Library: OpenSSL - OpenSSL 1.0.2k-fips 26 Jan 2017 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: /ifswh4/BC_PUB_T1/Pipeline/AIS/ais_java/mq/rabbitmq_server-3.10.0/var/log/rabbitmq/rabbit@wh-pms-b04-1.log /ifswh4/BC_PUB_T1/Pipeline/AIS/ais_java/mq/rabbitmq_server-3.10.0/var/log/rabbitmq/rabbit@wh-pms-b04-1_upgrade.log <stdout> Config file(s): (none) Starting broker... completed with 0 plugins.
4 其他配置
4.1 使用配置文件启动
$ vi ~/.bashrc //添加如下内容 export RABBITMQ_CONFIG_FILE=/ifswh4/BC_PUB_T1/Pipeline/AIS/ais_java/mq/rabbitmq_server-3.10.0/rabbitmq.conf
配置文件
$ cat rabbitmq.conf listeners.tcp.default = 0.0.0.0:5672 management.tcp.port = 15672
启动
$ nohup ./sbin/rabbitmq-server &
4.2 允许管理页面
./sbin/rabbitmq-plugins enable rabbitmq_management
默认登陆账号密码为guest/guest
4.3 添加用户、授权
//添加用户 $ ./rabbitmqctl add_user admin 密码 //权限组 $ ./rabbitmqctl set_user_tags admin administrator //授权对默认vhost具有所有权限 $ ./rabbitmqctl set_permissions -p / admin ".*" ".*" ".*" //删除默认用户 $ ./rabbitmqctl delete_user guest
4.4 设置日志位置
$ vi ~/.bashrc export RABBITMQ_LOG_BASE=/ifswh4/BC_PUB_T1/Pipeline/AIS/ais_java/mq/rabbitmq_server-3.10.0/logs/ export RABBITMQ_LOG_LEVEL=debug
浙公网安备 33010602011771号