1、RabbitMQ的安装需要首先安装Erlang,因为它是基于Erlang的VM运行的;
2、RabbitMQ需要的依赖:socat、logrotate、logrotate,后两个操作系统中已经存了,只需要安装socat即可;
3、安装socat:
[root@10 /]# yum install socat -y
.......
总下载量:290 k
安装大小:1.1 M
Downloading packages:
socat-1.7.3.2-2.el7.x86_64.rpm | 290 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : socat-1.7.3.2-2.el7.x86_64 1/1
验证中 : socat-1.7.3.2-2.el7.x86_64 1/1
已安装:
socat.x86_64 0:1.7.3.2-2.el7
完毕!
1、下载地址:https://github.com/rabbitmq/erlang-rpm/releases/download/v23.0.2/erlang-23.0.2-1.el7.x86_64.rpm
2、安装包上传linux服务器;
3、安装软件包:
[root@10 software]# pwd
/home/laosan/software
[root@10 software]# yum -y install erlang-23.0.2-1.el7.x86_64.rpm
1、下载地址:https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.5/rabbitmq-server-3.8.5-1.el7.noarch.rpm
2、安装包上传linux服务器;
3、安装软件包:
[root@10 software]# pwd
/home/laosan/software
[root@10 software]# yum -y install rabbitmq-server-3.8.5-1.el7.noarch.rpm
已加载插件:fastestmirror, langpacks
正在检查 rabbitmq-server-3.8.5-1.el7.noarch.rpm: rabbitmq-server-3.8.5-1.el7.noarch
rabbitmq-server-3.8.5-1.el7.noarch.rpm 将被安装
1、开机启动项:
[root@10 software]# systemctl list-unit-files | grep rabbitmq-server
rabbitmq-server.service disabled
2、disabled代表不会随着开机启动;
3、查看rabbitmq安装目录:
[root@10 rabbitmq_server-3.8.5]# pwd
/usr/lib/rabbitmq/lib/rabbitmq_server-3.8.5
[root@10 rabbitmq_server-3.8.5]# ll
总用量 16
drwxr-xr-x. 2 root root 4096 8月 5 22:01 escript
drwxr-xr-x. 2 root root 4096 8月 5 22:01 plugins
drwxr-xr-x. 2 root root 4096 8月 5 22:01 sbin
4、plugins——自带插件;sbin——可执行文件;
1、执行命令:
[root@10 sbin]# pwd
/usr/lib/rabbitmq/lib/rabbitmq_server-3.8.5/sbin
[root@10 sbin]# rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@10:
rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@10...
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.
2、查看插件列表;
[root@10 sbin]# rabbitmq-plugins list
Listing plugins with pattern ".*" ...
Configured: E = explicitly enabled; e = implicitly enabled
| Status: [failed to contact rabbit@10 - status not shown]
|/
[ ] rabbitmq_amqp1_0 3.8.5
[ ] rabbitmq_jms_topic_exchange 3.8.5
[E ] rabbitmq_management 3.8.5
[e ] rabbitmq_management_agent 3.8.5
[ ] rabbitmq_mqtt 3.8.5
[ ] rabbitmq_trust_store 3.8.5
[e ] rabbitmq_web_dispatch 3.8.5
[ ] rabbitmq_web_stomp 3.8.5
[ ] rabbitmq_web_stomp_examples 3.8.5
3、插件前面大写E代表手动启用该插件,小写字母e代表自动启动该插件;
1、前台模式执行启动命令(后台启动需要在命令后面加上-detached):
[root@10 sbin]# rabbitmq-server
## ## RabbitMQ 3.8.5
## ##
########## Copyright (c) 2007-2020 VMware, Inc. or its affiliates.
###### ##
########## Licensed under the MPL 1.1. Website: https://rabbitmq.com
Doc guides: https://rabbitmq.com/documentation.html
Support: https://rabbitmq.com/contact.html
Tutorials: https://rabbitmq.com/getstarted.html
Monitoring: https://rabbitmq.com/monitoring.html
Logs: /var/log/rabbitmq/[email protected]
/var/log/rabbitmq/rabbit@localhost_upgrade.log
Config file(s): (none)
Starting broker... completed with 3 plugins.
2、已经启动且同时启用三个插件;
1、浏览器输入地址登陆:http://192.168.0.104:15672/
2、输入用户名和密码分别为系统自带的guest;
3、提示该用户只能本机登陆;
1、再开一个窗口查看当前用户有哪些:
[root@10 ~]# rabbitmqctl list_users
Listing users ...
user tags
guest [administrator]
2、添加用户laosan和密码:
[root@10 ~]# rabbitmqctl add_user laosan 123456
Adding user "laosan" ...
[root@10 ~]# rabbitmqctl list_users
Listing users ...
user tags
guest [administrator]
laosan []
3、给用户laosan设置标签
[root@10 ~]# rabbitmqctl set_user_tags laosan administrator
Setting tags for user "laosan" to [administrator] ...
4、给用户laosan设置权限
[root@10 ~]# rabbitmqctl set_permissions laosan -p / ".*" ".*" ".*"
Setting permissions for user "laosan" in vhost "/" ...
5、再次登录页面,访问成功管理页面
[root@10 software]# rpm -ivh erlang-23.0.2-1.el7.x86_64.rpm rabbitmq-server-3.8.5-1.el7.noarch.rpm
警告:erlang-23.0.2-1.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID 6026dfca: NOKEY
错误:依赖检测失败:
libcrypto.so.10(OPENSSL_1.0.2)(64bit) 被 erlang-23.0.2-1.el7.x86_64 需要
libsystemd.so.0()(64bit) 被 erlang-23.0.2-1.el7.x86_64 需要
libsystemd.so.0(LIBSYSTEMD_209)(64bit) 被 erlang-23.0.2-1.el7.x86_64 需要
解决:
1、下载openssl安装包:http://rpmfind.net/linux/rpm2html/search.php?query=libcrypto.so.10%28OPENSSL_1.0.2%29%2864bit%29&submit=Search+…&system=&arch=
2、升级openssl:
[root@10 software]# rpm -ivh openssl-libs-1.0.2k-19.el7.x86_64.rpm
准备中... ################################# [100%]