fedora30(linux):安装rabbitmq 3.8.14
一,查看rabbitmq对应的erlang版本:
1,rabbitmq官网:
https://www.rabbitmq.com/
2,查看rabbitmq和erlang的对应版本
https://www.rabbitmq.com/which-erlang.html
如图:
说明:刘宏缔的架构森林是一个专注架构的博客,
网站:https://blog.imgtouch.com
本文: https://blog.imgtouch.com/index.php/2023/05/27/fedora30-linux-an-zhuang-rabbitmq-3-8-14/
对应的源码可以访问这里获取: https://github.com/liuhongdi/
说明:作者:刘宏缔 邮箱: 371125307@qq.com
二,下载erlang并安装
请参见:
三,下载rabbitmq:
1,从下载页面找到下载的地址:
https://www.rabbitmq.com/download.html
在下载页面,选择:
-
Install: Generic binary build
复制链接地址:
https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.14/rabbitmq-server-generic-unix-3.8.14.tar.xz
2,从命令行下载:
[root@localhost source]# wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.14/rabbitmq-server-generic-unix-3.8.14.tar.xz
四,安装rabbitmq
1,解压:
[root@localhost source]# xz -d rabbitmq-server-generic-unix-3.8.14.tar.xz [root@localhost source]# tar -xvf rabbitmq-server-generic-unix-3.8.14.tar
2,移动到安装目录:
[root@localhost source]# mv rabbitmq_server-3.8.14/ /usr/local/soft/
3,配置环境变量
[root@localhost source]# vi /etc/profile
内容:增加以下三行:
# rabbitMQ export RABBITMQ_PATH=/usr/local/soft/rabbitmq_server-3.8.14/sbin export PATH=$RABBITMQ_PATH:$PATH
使生效:
[root@localhost source]# source /etc/profile
4,启用管理插件:
[root@localhost source]# rabbitmq-plugins enable rabbitmq_management Enabling plugins on node rabbit@localhost: rabbitmq_management The following plugins have been configured: rabbitmq_management rabbitmq_management_agent rabbitmq_web_dispatch Applying plugin configuration to rabbit@localhost... The following plugins have been enabled: rabbitmq_management rabbitmq_management_agent rabbitmq_web_dispatch set 3 plugins. Offline change; changes will take effect at broker restart.
5,启动服务
[root@localhost source]# rabbitmq-server -detached
6,查看状态
[root@localhost source]# rabbitmqctl status
7,添加用户:
创建一个用户
[root@localhost source]# rabbitmqctl add_user root 123456
设置用户角色
[root@localhost source]# rabbitmqctl set_user_tags root administrator Setting tags for user "root" to [administrator] ...
列出所有用户
[root@localhost source]# rabbitmqctl list_users
Listing users ...
user tags
guest [administrator]
root [administrator]
设置权限
[root@localhost ~]# rabbitmqctl set_permissions -p / root ".*" ".*" ".*" Setting permissions for user "root" in vhost "/" ...
列出用户的权限
[root@localhost ~]# rabbitmqctl list_user_permissions root Listing permissions for user "root" ... vhost configure write read / .* .* .*
8,停止服务:
查看服务启动时的端口:
[root@localhost ~]# ss -lntp State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 0.0.0.0:25672 0.0.0.0:* users:(("beam.smp",pid=112195,fd=80)) LISTEN 0 128 0.0.0.0:4369 0.0.0.0:* users:(("epmd",pid=109598,fd=3)) LISTEN 0 1024 0.0.0.0:15672 0.0.0.0:* users:(("beam.smp",pid=112195,fd=93)) LISTEN 0 128 *:5672 *:* users:(("beam.smp",pid=112195,fd=94)) LISTEN 0 128 [::]:4369 [::]:* users:(("epmd",pid=109598,fd=4)) LISTEN 0 50 *:1716 *:* users:(("kdeconnectd",pid=1341,fd=13))
关闭服务
[root@localhost ~]# rabbitmqctl stop
Stopping and halting node rabbit@localhost …
查看服务关闭后的端口:
[root@localhost ~]# ss -lntp State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 0.0.0.0:4369 0.0.0.0:* users:(("epmd",pid=109598,fd=3)) LISTEN 0 128 [::]:4369 [::]:* users:(("epmd",pid=109598,fd=4)) LISTEN 0 50 *:1716 *:* users:(("kdeconnectd",pid=1341,fd=13))
说明:从rabbitmqctl status命令也可以看到rabbitmq所启用的端口
Interface: [::], port: 15672, protocol: http, purpose: HTTP API Interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication Interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
五,从浏览器测试效果:
1,访问:
http://127.0.0.1:15672/
返回:
此处可以用guest/guest登录,
我们用我们所创建的root/123456登录
六,查看rabbitmq的版本:
[root@localhost ~]# rabbitmqctl --version 3.8.14
七,查看linux的版本:
[root@localhost ~]# more /etc/redhat-release Fedora release 30 (Thirty)