官方的一些文档
官方推荐的安装方式:推荐
安装
- 安装依赖
$ yum install socat logrotate -y
- 安装 gpgkey 密钥
$ rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
$ rpm --import https://packagecloud.io/rabbitmq/erlang/gpgkey
$ rpm --import https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
- 设置仓库,这里仓库看自己是什么版本 CentOS,如果是 CentOS 8 就把 7 改成 8。
$ vim /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
# 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 server
##
[rabbitmq_server]
name=rabbitmq_server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
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 包元数据
$ yum update -y
$ yum -q makecache -y --disablerepo='*' --enablerepo='rabbitmq_erlang' --enablerepo='rabbitmq_server'
- 最后,从指定的仓库中安装 Erlang 和 RabbitMQ
$ [root@base ~]# yum install --disablerepo='*' --enablerepo='rabbitmq_erlang' --enablerepo='rabbitmq_server' erlang rabbitmq-server -y
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 erlang.x86_64.0.23.3.4.11-1.el7 将被 安装
---> 软件包 rabbitmq-server.noarch.0.3.10.0-1.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=================================================================================================================================================================================
Package 架构 版本 源 大小
=================================================================================================================================================================================
正在安装:
erlang x86_64 23.3.4.11-1.el7 rabbitmq_erlang 19 M
rabbitmq-server noarch 3.10.0-1.el7 rabbitmq_server 14 M
事务概要
=================================================================================================================================================================================
安装 2 软件包
总下载量:33 M
安装大小:53 M
Downloading packages:
(1/2): rabbitmq-server-3.10.0-1.el7.noarch.rpm | 14 MB 00:00:14
(2/2): erlang-23.3.4.11-1.el7.x86_64.rpm | 19 MB 00:00:15
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 2.2 MB/s | 33 MB 00:00:15
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : erlang-23.3.4.11-1.el7.x86_64 1/2
正在安装 : rabbitmq-server-3.10.0-1.el7.noarch 2/2
验证中 : erlang-23.3.4.11-1.el7.x86_64 1/2
验证中 : rabbitmq-server-3.10.0-1.el7.noarch 2/2
已安装:
erlang.x86_64 0:23.3.4.11-1.el7 rabbitmq-server.noarch 0:3.10.0-1.el7
完毕!
- 启动
$ systemctl enable rabbitmq-server
$ systemctl start rabbitmq-server
# 关闭防火墙
$ systemctl stop firewalld
- 启动管控台
$ rabbitmq-plugins enable rabbitmq_management
- 网页登录管控台
提示只能本地 localhost
管控台登录,不允许远程登录。这是因为 guest
出现过太多的安全问题,新版本默认已经不支持 guest 远程登录。两种解决办法:
- 修改配置文件,让 guest 可以远程登录。
- 新建用户,赋予权限(推荐)。
- 新建 admin 用户,赋予权限
$ rabbitmqctl add_user admin 'kzh_mxg4vfb2QRP*xkv'
$ rabbitmqctl set_permissions -p "/" "admin" ".*" ".*" ".*"
$ rabbitmqctl set_user_tags admin administrator
之后就可以使用 admin
进行登录了。
- Tips
此种安装方式是安装的 RabbitMQ 提供的 Erlang。官方是这么说的:
Team RabbitMQ produces a package stripped down to only provide those components needed to run RabbitMQ. This is the recommended option.
This is a (virtually) zero dependency 64-bit Erlang RPM package that provides
just enough to run RabbitMQ
. It may be easier to install than other Erlang RPMs in most environments. It may or may not be suitable for running other Erlang-based software or 3rd party RabbitMQ plugins.RabbitMQ 团队提供了一个精简包,仅提供运行 RabbitMQ 所需的那些组件。这是推荐的选项。
这是一个(几乎)零依赖的 64 位 Erlang RPM 包,它
提供了足够运行 RabbitMQ 的依赖
。在大多数环境中,它可能比其他 Erlang RPM 更容易安装。它可能适合也可能不适合运行其他基于 Erlang 的软件或第 3 方 RabbitMQ 插件。如果你有一些其他的基于 Erlang 语言的程序或者第三方 RabbitMQ 插件,可能不能正常运行,因为这个 Erlang 是阉割版的。
文章评论