RabbitMQ安装配置(CentOS)

1. 下载与安装

安装rabbitmq-server,需要先安装python和erlang
Centos系统自带python,如果不嫌版本低,可以跳过安装
下载安装erlang,官网下载

# 安装erlang源
wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
# 安装erlang
yum install -y erlang

下载安装RabbitMQ,官网下载

# 下载rabbitmq-server
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.0/rabbitmq-server-3.6.0-1.noarch.rpm
# 安装
rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
yum install rabbitmq-server-3.6.0-1.noarch.rpm
# 安装成服务
chkconfig rabbitmq-server on
# 开启管理插件
rabbitmq-plugins enable rabbitmq-management

2. 配置

2.1 配置hosts
# hosts
echo "127.0.0.1    localhost    your_hostname" >> /etc/hosts

如需远程,开放5672和15672(management用)端口

2.2 添加管理员用户
# 添加用户admin,密码admin@rabbit
rabbitmqctl add_user admin admin@rabbit
# 赋予administrator角色
rabbitmqctl set_user_tags admin administrator
2.3 添加virtual host
# 添加vhost
rabbitmqctl add_vhost /hostname
# 设置vhost的用户权限
rabbitmqctl set_permissions -p /hostname username ".*" ".*" ".*"

你可能感兴趣的:(rabbitmq,centos)