多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
**1. 下载RabbitMQ与Erlang** (1)RabbitMQ下载地址:https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.8.8 ![](https://img.kancloud.cn/11/07/11071121ec7c34b3281b1dbe48bae87d_1553x234.jpg) (2)Erlang下载地址:https://github.com/rabbitmq/erlang-rpm/tags ![](https://img.kancloud.cn/58/5d/585d80ccf9c4fd72e6f0be435c66a31f_2017x466.jpg) **2. 上传到Linux上** ![](https://img.kancloud.cn/f1/39/f139ffabab5ab42ef8267a40e0700ed7_1475x62.jpg) **3. 按照下面顺序安装** ```shell # wget https://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/openssl-libs-1.0.2k-19.el7.x86_64.rpm # rpm -ivh openssl-libs-1.0.2k-19.el7.x86_64.rpm --force # rpm -ivh erlang-21.3-1.el7.x86_64.rpm # yum install socat -y # rpm -ivh rabbitmq-server-3.8.8-1.el7.noarch.rpm ``` **4. 执行下面命令** ```shell (1)开机自启 # systemctl enable rabbitmq-server.service (2)启动RabbitMQ服务和Erlang虚拟机 # rabbitmq-server -detached (3)查看服务状态 # rabbitmqctl status ``` **5. 开启WEB插件** (1)开启WEB插件。 ```shell # rabbitmq-plugins enable rabbitmq_management ``` (2)访问:http://192.168.0.107:15672/ ,默认用户名:`guest`,默认密码:`guest`。 ![](https://img.kancloud.cn/af/3e/af3e968ddebadb6687ee493710f07b43_1623x437.jpg) 因为默认的账户`guest`只能在本地登录,所以在这里是访问不了的,需要添加新的用户。 **6. 添加新用户** (1)查看所有用户 ```shell [root@localhost ~]# rabbitmqctl list_users Listing users ... user tags guest [administrator] ``` (2)添加一个新用户 ```shell 语法:rabbitmqctl add_user 账号 密码 ``` ```shell # rabbitmqctl add_user admin admin ``` (3)设置用户角色 ```shell 语法:rabbitmqctl set_user_tags 账号 角色 ``` ```shell # rabbitmqctl set_user_tags admin administrator ``` (4)给当前用户赋予权限 ```shell 语法:rabbitmqctl set_permissions [-p <vhostpath>] <user> <conf> <write> <read> ``` ``` --赋予admin用户具有 /vhost1 这个 virtual host 中所有资源的配置、写、读权限 # rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*" ``` (5)重启RabbitMQ ```shell # rabbitmqctl start_app ``` (6)访问 http://192.168.0.107:15672/ ,用户名:`admin`,密码:`admin`。 ![](https://img.kancloud.cn/d3/f4/d3f477b49fd2441d793c98ac17c0c20e_1593x296.jpg) ![](https://img.kancloud.cn/71/5e/715e0ae383b6e72f865a1aaaf19c20af_1920x706.jpg)