概述
RabbitMQ 基于 Erlang,安装前,需要安装对应版本的 Erlang 官网 RabbitMQ 与 Erlang 版本对照表 https://www.rabbitmq.com/which-erlang.html CentOS 7 环境下安装
安装
安装erlang
- 查看是否存在旧erlang版本
erl -version
- 若版本低于(version 11.2.2),卸载erlang
yum -y remove erlang-*
- 安装erlang所依赖工具
yum -y install make gcc gcc-c kernel-devel m4 ncurses-devel openssl-devel
- 安装 socat
erlang内存管理依赖socat
yum install -y socat
- 安装 signing-key,用于和 yum更新源通信
rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
- 更新源
vi /etc/yum.repos.d/rabbitmq_erlang.repo
将对应的内容拷贝到文件里面,参考链接:https://github.com/rabbitmq/erlang-rpm 使用 Erlang 23.3 配置 复制除 begin end 分割线外的中间内容
[rabbitmq_erlang]
name=rabbitmq-rabbitmq-erlang
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/rpm/el/7/$basearch
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
[rabbitmq_erlang-noarch]
name=rabbitmq-rabbitmq-erlang-noarch
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/rpm/el/7/noarch
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
[rabbitmq_erlang-source]
name=rabbitmq-rabbitmq-erlang-source
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/rpm/el/7/SRPMS
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
- 更新源 yum update -y
- 安装erlang yum install -y erlang-23.3.4
安装 RabbitMQ
- 安装RabbitMQ
yum install -y https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.22/rabbitmq-server-3.8.22-1.el7.noarch.rpm
- systemctl 系统命令操作
systemctl start rabbitmq-server #启动 systemctl restart rabbitmq-server #重启 systemctl stop rabbitmq-server #关闭 systemctl status rabbitmq-server #查看状态
- rabbitmqctl 相关命令
sudo rabbitmqctl status #查看服务状态 sudo rabbitmqctl version #查看服务版本