当前位置:   article > 正文

centos7下RabbitMQ的安装_centos7 docker rabbitmq 安装

centos7 docker rabbitmq 安装

RabbitMQ官网:https://www.rabbitmq.com/

docker安装

RabbitMQ官网docker安装教程:https://www.rabbitmq.com/download.html

# docker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
  • 1

centos安装

官网安装教程:https://www.rabbitmq.com/install-rpm.html

这里安装的环境:

# uname -a
Linux localhost.localdomain 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/redhat-release 
CentOS Linux release 7.7.1908 (Core)
  • 1
  • 2
  • 3
  • 4

安装erlang

使用快速安装脚本:

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

这个脚本会在生成/etc/yum.repos.d/rabbitmq_erlang.repo文件:

# cat /etc/yum.repos.d/rabbitmq_erlang.repo 
[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

安装:

# yum install -y erlang
  • 1

安装rabbitmq

使用快速安装脚本:

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

这个脚本会在生成/etc/yum.repos.d/rabbitmq_rabbitmq-server.repo文件:

# cat /etc/yum.repos.d/rabbitmq_rabbitmq-server.repo 
[rabbitmq_rabbitmq-server]
name=rabbitmq_rabbitmq-server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_rabbitmq-server-source]
name=rabbitmq_rabbitmq-server-source
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

然后就可以使用yum进行安装了:

# yum install socat logrotate -y
# yum install rabbitmq-server -y
  • 1
  • 2

启动rabbitmq:

# systemctl start rabbitmq-server
# systemctl status rabbitmq-server
● 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-09 08:25:28 EDT; 27s ago
 Main PID: 50434 (beam.smp)
   Status: "Initialized"
   CGroup: /system.slice/rabbitmq-server.service
           ├─50434 /usr/lib64/erlang/erts-11.2.2.1/bin/beam.smp -W w -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -sbwt no...
           ├─50449 erl_child_setup 32768
           ├─50472 /usr/lib64/erlang/erts-11.2.2.1/bin/epmd -daemon
           ├─50489 inet_gethost 4
           └─50490 inet_gethost 4

Jun 09 08:25:22 localhost.localdomain rabbitmq-server[50434]: ##########  Licensed under the MPL 2.0. Website: https://rabbitmq.com
Jun 09 08:25:22 localhost.localdomain rabbitmq-server[50434]: Doc guides: https://rabbitmq.com/documentation.html
Jun 09 08:25:22 localhost.localdomain rabbitmq-server[50434]: Support:    https://rabbitmq.com/contact.html
Jun 09 08:25:22 localhost.localdomain rabbitmq-server[50434]: Tutorials:  https://rabbitmq.com/getstarted.html
Jun 09 08:25:22 localhost.localdomain rabbitmq-server[50434]: Monitoring: https://rabbitmq.com/monitoring.html
Jun 09 08:25:22 localhost.localdomain rabbitmq-server[50434]: Logs: /var/log/rabbitmq/rabbit@localhost.log
Jun 09 08:25:22 localhost.localdomain rabbitmq-server[50434]: /var/log/rabbitmq/rabbit@localhost_upgrade.log
Jun 09 08:25:22 localhost.localdomain rabbitmq-server[50434]: Config file(s): (none)
Jun 09 08:25:28 localhost.localdomain rabbitmq-server[50434]: Starting broker... completed with 0 plugins.
Jun 09 08:25:28 localhost.localdomain systemd[1]: Started RabbitMQ broker.
# systemctl enable rabbitmq-server
Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

开启管理后台功能:

# rabbitmq-plugins enable rabbitmq_management
  • 1

浏览器打开:http://192.168.80.205:15672/,管理后台的默认端口为15672,默认账户密码为guest/guest。

默认账户只能在localhost访问,这里添加一个用户:

# rabbitmqctl add_user root root
Adding user "root" ...
Done. Don't forget to grant the user permissions to some virtual hosts! See 'rabbitmqctl help set_permissions' to learn more.
# rabbitmqctl set_user_tags root administrator
Setting tags for user "root" to [administrator] ...
  • 1
  • 2
  • 3
  • 4
  • 5

使用root/root进行登录:

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/678214
推荐阅读
相关标签
  

闽ICP备14008679号