1.添加rabbitmq yum源

yum源配置文件夹(/etc/yum.repos.d)下添加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之后,可以解决Erlang版本和操作系统版本问题。

2.yum安装rabbitmq

#更新yum源
yum update -y

#install these dependencies from standard OS repositories
yum install socat logrotate -y

#安装erlang和rabbitmq
yum install erlang rabbitmq-server -y

3.查看安装版本

#查看Erlang
erl -v
Erlang/OTP 24 [erts-12.1.5] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1]
Eshell V12.1.5  (abort with ^G)
1>
1>halt().

#查看rabbitmq,可能要启动后才能使用rabbitmqctl
rabbitmqctl version
3.9.10

4.启动rabbitmq

#启动
systemctl start rabbitmq-server

#查看状态
systemctl status rabbitmq-server

5.防火墙开放端口访问

需要开放5672与15672端口,15672端口为管理界面使用

#添加5672及15672
firewall-cmd --permanent --zone=public --add-port=5672/tcp
firewall-cmd --permanent --zone=public --add-port=15672/tcp

#重新加载防火墙数据
firewall-cmd --reload

6.启用WEB管理页面插件

sudo /sbin/rabbitmq-plugins enable rabbitmq_management

7.添加访问用户

#查询安装默认的用户(一般有一个guest 用户和一个administrator管理员用户)
rabbitmqctl list_users

#其中admin 是用户名,123456是密码
rabbitmqctl add_user admin 123456

#通过命令给用户增加角色权限 
rabbitmqctl set_user_tags admin administrator

#给用户增加所有访问权限 
rabbitmqctl  set_permissions -p "/" admin '.*' '.*' '.*'

番外篇:安装延迟队列

1、获取延迟队列插件

官方下载:https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases
文件:请查看本文档所携带的附件【rabbitmq_delayed_message_exchange-3.10.0.ez】

2、插件安装启用

#将文件上传至RabbitMQ的插件目录下,按照以上步骤操作的文件目录是:/usr/lib/rabbitmq/lib/rabbitmq_server-3.10.0/plugins
#如果没有此目录,那就使用find命令进行查找
find / -name rabbitmq

#文件上传后,到RabbitMQ的bin目录下启动插件
rabbitmq-plugins enable rabbitmq_delayed_message_exchange

#最后一步,重启RabbitMQ
systemctl restart rabbitmq-server

3、检查插件是否安装成功

登录至RabbitMQ的WEB管理后台,检查Exchanges-->Add a new exchange --> type是否有X-delayed-message选项

4. 附件:

插件百度云地址:

以上就是安装Centos7系统下的安装RabbitMQ3.10的全部教程.