CentOS7下安装rabbitmq消息队

时间:2022-06-07 10:15:23

安装如下步骤:

1、首先安装erlang

yum install erlang

注:如果出现No package erlang available.

CentOS7下安装rabbitmq消息队

rpm -Uvh http://download.Fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm

2、安装rabbitmq rpm包

wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el7.noarch.rpm
yum install rabbitmq-server-3.6.6-1.el7.noarch.rpm

3、启动rabbitmq

service rabbitmq-server start

注:如果启动失败,报错如下:

CentOS7下安装rabbitmq消息队

则修改hosts,添加hostname:

vi /etc/hosts

添加hostname:

CentOS7下安装rabbitmq消息队

再次重启即可:

CentOS7下安装rabbitmq消息队

4、打开5672端口

/sbin/iptables -I INPUT -p tcp --dport 5672 -j ACCEPT
/etc/rc.d/init.d/iptables save
/etc/init.d/iptables restart

CentOS7下安装rabbitmq消息队

5、启用插件

rabbitmq-plugins enable rabbitmq_management

6、重启rabbitmq

service rabbitmq-server restart

7、web访问

CentOS7下安装rabbitmq消息队

8、无法登录请使用如下:

vim /etc/rabbitmq/rabbitmq.config

写入如下信息并保存:

[{rabbit, [{loopback_users, []}]}].

CentOS7下安装rabbitmq消息队

再重启:

CentOS7下安装rabbitmq消息队

再次访问即可:

CentOS7下安装rabbitmq消息队

9、修改默认的客户端侦听端口

a、修改/etc/rabbitmq/rabbitmq.config

[
{rabbit, [{tcp_listeners, [5700]}]}
].

 b、修改/etc/rabbitmq/rabbitmq-env.conf

NODE_PORT=5700

10、添加用户

rabbitmqctl add_user admin admin
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p '/' admin '.*' '.*' '.*'