CentOs安装RabbitMQ

下载

官网:https://www.rabbitmq.com/download.html

选择rpm包安装方式:

rabbitmq下载:https://github.com/rabbitmq/rabbitmq-server/releases

erlang下载:https://github.com/rabbitmq/erlang-rpm/releases

erlang-23.2.7-1.el7.x86_64.rpm

rabbitmq-server-3.8.30-1.el7.noarch.rpm

安装

1
2
3
rpm -ivh erlang-23.2.7-1.el7.x86_64.rpm
yum install -y socat
rpm -ivh rabbitmq-server-3.8.30-1.el7.noarch.rpm

开启web管理插件

1
rabbitmq-plugins enable rabbitmq_management

启动和关闭服务

1
2
3
4
systemctl start rabbitmq-server
systemctl status rabbitmq-server
systemctl stop rabbitmq-server
systemctl enable rabbitmq-server

添加用户

默认的guest用户只能本地访问,所以要添加用户

1
2
3
4
5
6
7
rabbitmqctl add_user admin admin

//为用户分配操作权限
rabbitmqctl set_user_tags admin administrator

为用户分配资源权限
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"

防火墙设置

1
2
3
4
5
6
7
8
9
firewall-cmd --zone=public --add-port=5672/tcp --permanent
firewall-cmd --zone=public --add-port=15672/tcp --permanent
firewall-cmd --zone=public --add-port=4369/tcp --permanent
firewall-cmd --zone=public --add-port=25672/tcp --permanent

sudo firewall-cmd --reload

//查看开发的端口号
firewall-cmd --zone=public --list-ports

访问:

http://localhost:15672