rabbitmq的安装依赖erlang,首先应该先安装erlang,而后安装rabbitmq;html
erlang-rpm安装教程
选择在Centos7 上安装:
git
To use Erlang 20.x on CentOS 7:github
# In /etc/yum.repos.d/rabbitmq-erlang.repo [rabbitmq-erlang] name=rabbitmq-erlang baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/7 gpgcheck=1 gpgkey=https://www.rabbitmq.com/rabbitmq-release-signing-key.asc repo_gpgcheck=0 enabled=1
而后执行:web
yum install erlang
参考连接
centos
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/rabbitmq_v3_6_12/rabbitmq-server-3.6.12-1.el7.noarch.rpm
rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc yum install rabbitmq-server-3.6.12-1.el7.noarch.rpm
chkconfig rabbitmq-server on /sbin/service rabbitmq-server stop/start/
开启Web管理插件浏览器
rabbitmq-plugins enable rabbitmq_management output: The following plugins have been enabled: mochiweb webmachine rabbitmq_web_dispatch amqp_client rabbitmq_management_agent rabbitmq_management Applying plugin configuration to rabbit@PC-201602152056... started 6 plugins.
浏览器访问:
http://localhost:15672
,
默认用户名和密码: guest/guest;
须要注意的是:guest用户仅仅提供localhost做为ip登陆;
若是远程登陆,如:http://192.168.35.129:15672/
, 则会提示错误,登陆不了:app
# 以下是日志输出 =WARNING REPORT==== 21-Oct-2017::23:31:33 === HTTP access denied: user 'guest' - User can only log in via localhost
访问控制可参考:
Access Control (Authentication, Authorisation) in RabbitMQ
为了让guest可远程访问,须要修改rabbitmq.config
中的loopback_users
参数,设置为oop
[{rabbit, [{loopback_users, []}]}].
官网文档描述以下,可参考官方文档:RabbitMQ Configuration:this
loopback_users参数: List of users which are only permitted to connect to the broker via a loopback interface (i.e. localhost). If you wish to allow the default guest user to connect remotely, you need to change this to []. Default: [<<"guest">>]
默认安装时,rabbitmq.config
配置文件可能不存在,有两种方式能够设置配置文件;url
RABBITMQ_CONFIG_FILE
指定 rabbitmq.config
文件位置;If rabbitmq.config doesn't exist, it can be created manually. Set the RABBITMQ_CONFIG_FILE environment variable if you change the location. The Erlang runtime automatically appends the .config extension to the value of this variable.
修改完配置文件后,重启,就能够使用guest用户远程访问了;