CentOS 7 yum安装 RabbitMQ

方法 一
1、下载 erlang

wget http://www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el7.centos.x86_64.rpm
2、安装 erlang

rpm -ivh erlang-19.0.4-1.el7.centos.x86_64.rpm
检查是否安装成功

[root@centos7 src]# erl
Erlang/OTP 19 [erts-8.0.3] [source] [64-bit] [async-threads:10]…………

Eshell V8.0.3 (abort with ^G)
1>
3、下载 rabbitmq

wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el7.noarch.rpm
4、安装 rabbitmq

rpm -ivh rabbitmq-server-3.6.6-1.el7.noarch.rpm

# 如果提示如下
warning: rabbitmq-server-3.6.6-1.el7.noarch.rpm: Header V4 RSA/SHA1 Signature,
key ID 6026dfca: NOKEY
error: Failed dependencies:
socat is needed by rabbitmq-server-3.6.6-1.el7.noarch

# 安装 socat
yum install socat -y
方法 二
1、配置 epel

yum install epel-release
2、安装

yum install rabbitmq-server
5、启动

# 启动
systemctl start rabbitmq-server

# 状态
systemctl status rabbitmq-server

# 关闭
systemctl stop rabbitmq-server
6、配置网页插件(从网页登陆端口号:15672)

# 启用插件
rabbitmq-plugins enable rabbitmq_management
7、配置防火墙

# 添加端口
vi /etc/sysconfig/iptables
-A INPUT -p tcp -m state –state NEW -m tcp –dport 15672 -j ACCEPT

# 重启生效
systemctl restart iptables
8、配置访问账号密码和权限

# 添加用户mq,密码mq123
rabbitmqctl add_user mq mq123

# 添加权限
rabbitmqctl set_permissions -p / mq “.*” “.*” “.*”

# 修改用户角色
rabbitmqctl set_user_tags mq administrator

# 其它操作
# 删除一个用户
rabbitmqctl delete_user Username

# 修改用户密码
rabbitmqctl change_password Username Newpassword

# 查看当前用户列表
rabbitmqctl list_users
9、登陆

http://192.168.1.72:15672

 

Share