CentOS8 安装 RabbitMQ

RabbitMQ 安装记录

1.安装

1.1 环境

curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash

1.2 安装 Erlang 与 RabbitMQ

命令

yum install erlang -y

yum install rabbitmq-server -y

[root@centos8 ~]# rpm -qa | grep erlang
erlang-23.3.2-1.el8.x86_64
[root@centos8 ~]# rpm -qa | grep rabbitmq-server
rabbitmq-server-3.8.14-1.el8.noarch

## rabbitmq的管理平台插件
rabbitmq-plugins enable rabbitmq_management

[root@centos8 ~]# systemctl enable  rabbitmq-server
Created symlink /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service → /usr/lib/systemd/system/rabbitmq-server.service.
[root@centos8 ~]# systemctl start   rabbitmq-server
[root@centos8 ~]# systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2021-04-28 22:08:30 CST; 20s ago
   
## 开放端口
firewall-cmd --zone=public --add-port=15672/tcp --permanent
## 客户端端口
firewall-cmd --zone=public --add-port=5672/tcp --permanent
success
[root@centos8 ~]# firewall-cmd --reload
success
[root@centos8 ~]# firewall-cmd --list-port
6379/tcp 8080/tcp 443/tcp 8081/tcp 15672/tcp 5672/tcp
[root@centos8 ~]#

1.3 开始访问

http://ip:15672/

使用guest账号登录提示User can only log in via localhost,原因是:guest用户默认只能本地登录,我们需要重新添加一个管理员账号用于web远程登录

  • 创建一个账号
## 创建账号
rabbitmqctl add_user admin 123456
## 设置用户角色
rabbitmqctl  set_user_tags  admin administrator
## 设置用户权限
rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
## 查看当前登录用户
rabbitmqctl list_users
  • 使用 admin 123456 登录...开始学习 RabbitMQ!
posted @ 2021-04-30 21:38  andreamwu  阅读(1706)  评论(0编辑  收藏  举报