1、检查RabbitMQ、Erlang版本
Erlang Version Requirements | RabbitMQ
2、ubuntu20.04对应的是 focal
3、下载安装Erlang
下载地址:http://packages.erlang-solutions.com/erlang/debian/pool/
sudo dpkg -i esl-erlang_25.3-1~ubuntu~focal_amd64.deb
sudo apt-get install libwxbase3.0-0v5
sudo apt --fix-broken install
4、下载安装rabbitmq
下载地址:https://packagecloud.io/rabbitmq/rabbitmq-server
# 下载地址
wget --content-disposition https://packagecloud.io/rabbitmq/rabbitmq-server/packages/ubuntu/focal/rabbitmq-server_3.11.19-1_all.deb/download.deb
# 安装命令
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.deb.sh | sudo bash
sudo apt-get install rabbitmq-server=3.11.19-1
5、启动服务
systemctl start rabbitmq-server.service # 启动服务
systemctl stop rabbitmq-server.service # 停止服务
systemctl status rabbitmq-server.service # 查看状态
systemctl enable rabbitmq-server.service # 开机启动
6、用户管理
# 查看当前所有用户:
rabbitmqctl list_users
# 查看默认guest用户的权限:
rabbitmqctl list_user_permissions guest
# 由于RabbitMQ默认的账号用户名和密码都是guest,为了安全起见,先删掉默认用户
rabbitmqctl delete_user guest
# 添加新用户:
#rabbitmqctl add_user username password
rabbitmqctl add_user 账号 密码
# 分配用户标签
rabbitmqctl set_user_tags 账号 administrator
# 授予用户所有权限
rabbitmqctl set_permissions -p / 账号 ".*" ".*" ".*"
# 开启管理页面插件
rabbitmq-plugins enable rabbitmq_management