RabbitMQ安装

young 578 2022-04-19

版本关系

RabbitMQ依赖于Erlang环境,需先安装Erlang

Erlang与RabbitMQ有对应关系

http://www.rabbitmq.com/which-erlang.html

安装Erlang

前置依赖

yum install -y gcc glibc-devel make ncurses-devel openssl-devel xmlto perl wget socat

安装Erlang

https://www.erlang.org/downloads

wget https://github.com/erlang/otp/releases/download/OTP-24.3/otp_src_24.3.tar.gz
tar -xvf otp_src_24.3.tar.gz
cd otp_src_24.3
./configure --prefix=/usr/local/erlang

如果提示有err,需要解决依赖问题

如果有APPLICATIONS INFORMATION,DOCUMENTATION INFORMATION,没有影响

make && make instsall

配置环境变量

vim /etc/profile

加入环境变量

export PAHT=$PATH:/usr/local/erlang/bin

编译生效

source /etc/profile

验证

输入erl,出现版本信息则为安装成功

安装RabbitMQ

下载RabbitMQ

https://github.com/rabbitmq/rabbitmq-server/releases

wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.9.15/rabbitmq-server-generic-unix-latest-toolchain-3.9.15.tar.xz
xz -d rabbitmq-server-generic-unix-latest-toolchain-3.9.15.tar.xz
tar -xvf rabbitmq-server-generic-unix-latest-toolchain-3.9.15.tar

配置环境变量

假设下载目录在/usr/local

vim /etc/profile

增加配置

export PATH=$PATH:/usr/local/rabbitmq_server-3.9.15/sbin

编译生效

source /etc/profile

启动RabbitMQ

# 后台启动
cd /usr/local/rabbitmq_server-3.9.15/sbin
./rabbitmq-server -detached

或者

./rabbitmq-server start

或者

service rabbitmq-server start

添加其他用户

默认rabbitmq有一个guest用户,但是只能本机访问,增加一个管理员用户,用户名密码均为admin

./rabbitmqctl add_user admin admin
./rabbitmqctl set_user_tags admin administrator
./rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"

启动管理插件

./rabbitmq-plugins enable rabbitmq_management

访问端口:15672