记录一次rabbitmq安装过程,供自己及有需要的人参考。
前言:RabbitMQ不同版本对Erlang版本有要求(版本对比参考:Erlang版本要求),也对操作系统版本有要求(暂时没在官网找到对应关系),几经努力成功安装rabbitmq3.9.10版本,主要是参考了官网(官网位置)。
环境:腾讯云轻量级云服务器,CentOS7
查看系统版本:cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
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版本和操作系统版本问题。
#更新yum源
yum update -y
#install these dependencies from standard OS repositories
yum install socat logrotate -y
#安装erlang和rabbitmq
yum install erlang rabbitmq-server -y
#查看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>
#查看rabbitmq,可能要启动后才能使用rabbitmqctl
rabbitmqctl version
3.9.10
#启动
systemctl start rabbitmq-server
#查看状态
systemctl status rabbitmq-server
需要开发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
sudo /sbin/rabbitmq-plugins enable rabbitmq_management
#查询安装默认的用户(一般有一个guest 用户和一个administrator管理员用户)
rabbitmqctl list_users
#其中admin 是用户名,123456是密码
rabbitmqctl add_user admin 123456
#通过命令给用户增加角色权限
rabbitmqctl set_user_tags admin administrator
#给用户增加所有访问权限
rabbitmqctl set_permissions -p "/" admin '.*' '.*' '.*'
到此rabbitmq安装完成,页面URL:http://ip:15672/。
其他参考文章:
https://blog.csdn.net/weixin_37641832/article/details/85266867spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link