CentOS7安装RabbitMQ

一、安装RabbitMQ运行环境

1.安装gcc等编译环境

yum install -y gcc glibc-devel make ncurses-devel openssl-devel xmlto

2.下载并安装erlang

到http://rpm.pbone.net/index.php3/stat/4/idpl/29069710/dir/centos_7/com/epel-release-7-5.noarch.rpm.html查询rpm信息,下载rpm

wget ftp://bo.mirror.garr.it/1/slc/centos/7.0.1406/extras/x86_64/Packages/epel-release-7-5.noarch.rpm

rpm -ivh epel-release-7-5.noarch.rpm

3.安装erlang

yum install -y erlang

二、安装RabbitMQ服务

1.下载RabbitMQ的rpm安装源

wget http://www.rabbitmq.com/releases/rabbitmq-server/current/rabbitmq-server-3.6.15-1.el7.noarch.rpm

yum install -y rabbitmq-server-3.6.15-1.el7.noarch.rpm

2.设置SELinux 

yum install -y setroubleshoot
semodule -l|grep rabbitmq

audit2allow -a
grep beam /var/log/audit/audit.log|audit2allow -M rabbitmq_beam_t
semodule -i rabbitmq_beam_t.pp
semodule -r rabbitmq_beam_t

audit2allow -a
grep beam /var/log/audit/audit.log|audit2allow -M rabbitmq_beam_t
semodule -i rabbitmq_beam_t.pp

3.修改RabbitMQ配置文件

cp /usr/share/doc/rabbitmq-server-3.6.15/rabbitmq.config.example /etc/rabbitmq/rabbitmq.config

vi /etc/rabbitmq/rabbitmq.config

{loopback_users, []}

4.启动RabbitMQ服务

systemctl start rabbitmq-server

5.启用RabbitMQ插件

rabbitmq-plugins  enable rabbitmq_management

6.打开CentOS7防火墙中RabbitMQ的端口

firewall-cmd --permanent --add-port=5672/tcp
firewall-cmd --permanent --add-port=15672/tcp
firewall-cmd --reload
systemctl restart firewalld.service

7.设置RabbitMQ用户

rabbitmqctl add_user rabbituser 123456
rabbitmqctl set_user_tags rabbituser administrator

8.访问Rabbit管理页面

192.168.4.110:15672

完成安装,进行测试!

你可能感兴趣的:(CentOS7安装RabbitMQ)