https://www.rabbitmq.com/download.html
rabbitmq 是基于erlang语言开发的,所以需要准备erlang的依赖
erlang-21.3-1.el7.x86_64.rpm
rpm -ivh rabbitmq-server-3.8.8-1.el7.noarch.rpm
执行命令
[root@gone install]# rpm -ivh erlang-21.3-1.el7.x86_64.rpm
warning: erlang-21.3-1.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 6026dfca: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:erlang-21.3-1.el7 ################################# [100%]
[root@gone install]# yum install socat -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.ustc.edu.cn
* centos-sclo-rh: mirrors.ustc.edu.cn
* centos-sclo-sclo: mirrors.cn99.com
* extras: mirrors.ustc.edu.cn
* updates: mirrors.cn99.com
base | 3.6 kB 00:00:00
centos-sclo-rh | 3.0 kB 00:00:00
centos-sclo-sclo | 3.0 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package socat.x86_64 0:1.7.3.2-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================================
Installing:
socat x86_64 1.7.3.2-2.el7 base 290 k
Transaction Summary
=============================================================================================================================================================================================
Install 1 Package
Total download size: 290 k
Installed size: 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
Warning: RPMDB altered outside of yum.
Installing : socat-1.7.3.2-2.el7.x86_64 1/1
Verifying : socat-1.7.3.2-2.el7.x86_64 1/1
Installed:
socat.x86_64 0:1.7.3.2-2.el7
Complete!
[root@gone install]# rpm -ivh rabbitmq-server-3.8.8-1.el7.noarch.rpm
warning: rabbitmq-server-3.8.8-1.el7.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 6026dfca: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:rabbitmq-server-3.8.8-1.el7 ################################# [100%]
rabbitmq依赖socat环境不安装的话执行 rpm -ivh rabbitmq-server-3.8.8-1.el7.noarch.rpm 会报:
error: Failed dependencies:
socat is needed by rabbitmq-server-3.8.8-1.el7.noarch
执行命令
[root@gone ~]# /sbin/service rabbitmq-server.start
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
[root@gone ~]# /sbin/service rabbitmq-server start
Redirecting to /bin/systemctl start rabbitmq-server.service
查看启动状态 :Active:active (running) since Wed 2021-06-30 23:55:45 CST; 30s ago 表示启动成功
[root@gone ~]# /sbin/service rabbitmq-server status
Redirecting to /bin/systemctl status rabbitmq-server.service
?.rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2021-06-30 23:55:45 CST; 30s ago
Main PID: 11265 (beam.smp)
Status: "Initialized"
Tasks: 87
CGroup: /system.slice/rabbitmq-server.service
?..11265 /usr/lib64/erlang/erts-10.3/bin/beam.smp -W w -K true -A 64 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 128...
?..11374 erl_child_setup 32768
?..11399 /usr/lib64/erlang/erts-10.3/bin/epmd -daemon
?..11422 inet_gethost 4
?..11423 inet_gethost 4
Jun 30 23:55:40 gone rabbitmq-server[11265]: ########## Licensed under the MPL 2.0. Website: https://rabbitmq.com
Jun 30 23:55:40 gone rabbitmq-server[11265]: Doc guides: https://rabbitmq.com/documentation.html
Jun 30 23:55:40 gone rabbitmq-server[11265]: Support: https://rabbitmq.com/contact.html
Jun 30 23:55:40 gone rabbitmq-server[11265]: Tutorials: https://rabbitmq.com/getstarted.html
Jun 30 23:55:40 gone rabbitmq-server[11265]: Monitoring: https://rabbitmq.com/monitoring.html
Jun 30 23:55:40 gone rabbitmq-server[11265]: Logs: /var/log/rabbitmq/rabbit@gongchen.log
Jun 30 23:55:40 gone rabbitmq-server[11265]: /var/log/rabbitmq/rabbit@gongchen_upgrade.log
Jun 30 23:55:40 gone rabbitmq-server[11265]: Config file(s): (none)
Jun 30 23:55:45 gone rabbitmq-server[11265]: Starting broker... completed with 0 plugins.
Jun 30 23:55:45 gone systemd[1]: Started RabbitMQ broker.
先停止服务
[root@gone~]# /sbin/service rabbitmq-server stop
Redirecting to /bin/systemctl stop rabbitmq-server.service
执行
[root@gone~]# rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@gongchen:
rabbitmq_management
Error:
{:query, :rabbit@gongchen, {:badrpc, :timeout}}
出现错误
Error:
{:query, :rabbit@gongchen, {:badrpc, :timeout}}
需配置根路径下/etc/hosts 文件
查看主机名:
[root@gongchen ~]# hostnamectl
Static hostname: gone
Icon name: computer-vm
Chassis: vm
Machine ID: f909a7c64a28481ca83c81e25e768c27
Boot ID: a17729e6dd704ceab99f7ac81f0f1d67
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-1062.el7.x86_64
Architecture: x86-64
增加一行 (127.0.0.1 主机名)
[root@gone~]# vim /etc/hosts
127.0.0.1 gone
重新开启 web 管理插件
[root@gone~]# rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@gongchen:
rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@gongchen...
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.
输入 http://主机地址:15672
[root@gone~]# rabbitmqctl add_user admin admin ----创建账号
Adding user "admin" ...
[root@gone~]# rabbitmqctl set_user_tags admin administrator ----设置用户角色
Setting tags for user "admin" to [administrator] ...
[root@gone~]# rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*" ----设置用户权限
Setting permissions for user "admin" in vhost "/" ...
[root@gone~]# rabbitmqctl list_users ----当前用户和角色
Listing users ...
user tags
admin [administrator]
guest [administrator]
至此,安装完成