赞
踩
给自己的云服务器安装RabbitMQ服务。
官网提供的教程有两种,
1、一种是通过Package Cloud-provided script.进行快速的搭建。对于这种搭建方式,官网给出的建议是:这不是必需的,应该仔细考虑,因为它将生成的脚本从公共Internet传输到特权shell。
2、另一种是:一种更传统的方式,即显式安装Yum存储库文件。(本文使用的是这种方式)
3、当然,万能的Docker也是可以实现效果的,且更加的简单方便一点。可以看一下 大佬博客docker安装rabbitmq,有兴趣的可以参考一下
可以通过 lsb_release -b
命令查看centos的版本号。下面记录使用较为广泛centos7.x版本的安装教程。其他版本的服务器,可以参考下方的记录,自行在官网找到相应的文件,自行进行安装。
Yum将验证它安装的任何包的签名,因此该过程的第一步是导入签名密钥
## primary RabbitMQ signing key
rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
## modern Erlang repository
rpm --import https://packagecloud.io/rabbitmq/erlang/gpgkey
## RabbitMQ server repository
rpm --import https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
/etc/yum.repos.d
目录下创建一个rabbitmq.repo
文件cd /etc/yum.repos.d
vim rabbitmq.repo
# In /etc/yum.repos.d/rabbitmq.repo ## ## Zero dependency Erlang ## [rabbitmq_erlang] name=rabbitmq_erlang baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch repo_gpgcheck=1 gpgcheck=1 enabled=1 # PackageCloud's repository key and RabbitMQ package signing key gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc 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 ## ## RabbitMQ server ## [rabbitmq_server] name=rabbitmq_server baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/$basearch repo_gpgcheck=1 gpgcheck=1 enabled=1 # PackageCloud's repository key and RabbitMQ package signing key gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 [rabbitmq_server-source] name=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
yum update -y
## install these dependencies from standard OS repositories
yum install socat logrotate -y
yum install erlang rabbitmq-server -y
4、启动服务,开启管理界面
# To start the daemon by default when the system boots, as an administrator run chkconfig rabbitmq-server on #启动、查看状态、关闭服务 /sbin/service rabbitmq-server start /sbin/service rabbitmq-server status /sbin/service rabbitmq-server stop # 开启管理页面 rabbitmq-plugins enable rabbitmq_management
# 添加主机名为 first_test 的虚拟主机
rabbitmqctl add_vhost first_test
rabbitmqctl list_vhosts
默认的guest用户不允许外网访问。
所以要访问页面管理端的话,需要添加新的用户并分配对应的权限
rabbitmqctl add_user admin 123456
# 第一个first_test是虚拟主机名,admin是用户名
# 三个’.*'依次表示对所有资源有配置,写,读权限
rabbitmqctl set_permissions -p first_test admin '.*' '.*' '.*'
这里若是没有添加新的虚拟主机的话,可以直接给/
添加新角色
rabbitmqctl set_user_tags admin administrator
登录测试
访问服务地址服务器地址:15672
用相应的账号密码登录。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。