1、下载安装包
http://www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el7.centos.x86_64.rpm
http://www.rabbitmq.com/releases/erlang/esl-erlang-compat-18.1-1.noarch.rpm
2、安装 Erlang
yum localinstall -y erlang-19.0.4-1.el7.centos.x86_64.rpm
yum localinstall -y esl-erlang-compat-18.1-1.noarch.rpm
3、安装socat
wget --no-cache http://www.convirture.com/repos/definitions/rhel/6.x/convirt.repo -O /etc/yum.repos.d/convirt.repo
yum makecache
yum install socat
rpm -ivh rabbitmq-server-3.6.10-1.el6.noarch.rpm
4、安装RabbitMQ
rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
yum install -y rabbitmq-server-3.6.1-1.noarch.rpm
5、启动服务
先看下自己的主机名:hostname,我的主机名是:judasnHost2
先修改一下 host 文件:vim /etc/hosts,添加一行:127.0.0.1 judasnHost2(必须这样做)
启动:service rabbitmq-server start,启动一般都比较慢,所以别急
停止:service rabbitmq-server stop
重启:service rabbitmq-server restart
设置开机启动:chkconfig rabbitmq-server on
6、配置
查找默认配置位置:find / -name "rabbitmq.config.example",我这边搜索结果是:/usr/share/doc/rabbitmq-server-3.6.1/rabbitmq.config.example
复制默认配置:cp /usr/share/doc/rabbitmq-server-3.6.1/rabbitmq.config.example /etc/rabbitmq/
修改配置文件名:cd /etc/rabbitmq ; mv rabbitmq.config.example rabbitmq.config
编辑配置文件,开启用户远程访问:vim rabbitmq.config
在 64 行,默认有这样一句话:%% {loopback_users,[]},,注意,该语句最后有一个逗号,等下是要去掉的
我们需要改为:{loopback_users,[]}
开启 Web 界面管理:rabbitmq-plugins enable rabbitmq_management
重启 RabbitMQ 服务:service rabbitmq-server restart
开放防火墙端口:
sudo iptables -I INPUT -p tcp -m tcp --dport 15672 -j ACCEPT
sudo iptables -I INPUT -p tcp -m tcp --dport 5672 -j ACCEPT
sudo service iptables save
sudo service iptables restart
浏览器访问:http://192.168.1.114:15672 默认管理员账号:guest 默认管理员密码:guest
参考文章:https://github.com/judasn/Linux-Tutorial/blob/master/RabbitMQ-Install-And-Settings.md