Step 1:安装依赖库
$ sudo yum install gcc glibc-devel make ncurses-devel openssl-devel xmlto -y
Step2:安装Erlang
本文使用zero dependency Erlang RPM package for running RabbitMQ,该版本删除了一些运行RabbitMQ非必须的模块。
下载完成后直接make。
make过程中会下载OTP-20.0.4.tar.gz(速度还挺慢),一旦make失败下次make会重新下载,所以make之前务必确认准备工作已经做好
$ sudo make //sudo是必须的,或者使用root账户
$ cd ./RPMS/x86_64
$ sudo rpm -Uvh erlang-20.0.4-1.el7.centos.x86_64.rpm
Step 3:安装RabbitMQ Server
下载RPM包
rabbitmq-server-3.6.11-1.el7.noarch.rpm
安装
$ sudo rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
$ sudo yum install ./rabbitmq-server-3.6.11-1.el7.noarch.rpm -y
Step 4:启动RabbitMQ
$ sudo rabbitmq-server on
运行结果如下:
RabbitMQ 3.6.11. Copyright (C) 2007-2017 Pivotal Software, Inc.
## ## Licensed under the MPL. See http://www.rabbitmq.com/
## ##
########## Logs: /var/log/rabbitmq/rabbit@localhost.log
###### ## /var/log/rabbitmq/rabbit@localhost-sasl.log
##########
Starting broker...
Step 5:配置网页管理插件
$ sudo rabbitmq-plugins enable rabbitmq_management
运行结果如下:
lowing plugins have been enabled:
amqp_client
cowlib
cowboy
rabbitmq_web_dispatch
rabbitmq_management_agent
rabbitmq_management
Applying plugin configuration to rabbit@localhost... started 6 plugins
然后在浏览器中输入localhost:15672即可打开管理页面
接着创建管理用户,在su下运行下列命令
# rabbitmqctl add_user root root123456
# rabbitmqctl set_permissions -p "/" root ".*" ".*" ".*"
# rabbitmqctl set_user_tags root administrator
最后用刚才创建的用户登录管理页面