rabbitmq安装完整版

1.安装依赖文件

[root@lugu-wugu-wxfile mq]# yum install ncurses-develhtml

[root@lugu-wugu-wxfile mq]# yum -y install openssl
[root@lugu-wugu-wxfile mq]# yum -y install sslnode

[root@lugu-wugu-wxfile mq]# yum -y install xmltopython

[root@lugu-wugu-wxfile mq]# yum -y install python-simplejsonlinux

[root@lugu-wugu-wxfile mq]# yum -y install pythonweb

进入 http://www.erlang.org/download.html 选择源文件下载shell

[root@lugu-wugu-wxfile mq]# wget http://www.erlang.org/download/otp_src_17.5.tar.gzjson

[root@lugu-wugu-wxfile mq]# tar zxvf otp_src_17.5.tar.gzbash

[root@lugu-wugu-wxfile mq]# cd otp_src_17.5async

[root@lugu-wugu-wxfile mq]# ./configurespa

[root@lugu-wugu-wxfile mq]# make && make install

安装完成之后,执行erl看是否能打开eshell,用’halt().’退出,注意后面的点号,那是erlang的结束符。

[root@lugu-wugu-wxfile mq]# erl

Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V6.4  (abort with ^G)

1> 9+1.

10

2> halt().

2.安装RabbitMQ

下载rabbitmq安装包

[root@lugu-wugu-wxfile mq]# wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.0/rabbitmq-server-3.6.0.tar.xz

[root@lugu-wugu-wxfile mq]# xz -d rabbitmq-server-3.6.0.tar.xz

[root@lugu-wugu-wxfile mq]# tar xvf rabbitmq-server-3.6.0.tar

[root@lugu-wugu-wxfile mq]# cd rabbitmq-server-3.6.0

[root@lugu-wugu-wxfile mq]# make

[root@lugu-wugu-wxfile mq]# make install TARGET_DIR=/opt/rabbitmq SBIN_DIR=/opt/rabbitmq/sbin MAN_DIR=/opt/rabbitmq/man DOC_INSTALL_DIR=/opt/rabbitmq/doc

注意1:可能出现xz:Command not found

xz命令提示linux下提示bash:command not found解决方法

http://blog.sina.com.cn/s/blog_ba08e8e00101b1rs.html

注意2:make install时可能会报错:zip command not found.解决方法以下:

[root@lugu-wugu-wxfile mq]# yum install -y unzip zip;

3.使用RabbitMQ

启动MQ

[root@lugu-wugu-wxfile rabbitmq-server-3.6.0]# cd scripts/

[root@lugu-wugu-wxfile scripts]# ./rabbitmq-server -detached

Warning: PID file not written; -detached was passed.

查看状态

[root@lugu-wugu-wxfile scripts]# ./rabbitmqctl status

中止服务

[root@lugu-wugu-wxfile scripts]# ./rabbitmqctl stop

Stopping and halting node 'rabbit@lugu-wugu-wxfile' …

安装RabbitMQWeb管理插件

[root@lugu-wugu-wxfile scripts]# ./rabbitmq-plugins enable rabbitmq_management

Error: {cannot_write_enabled_plugins_file,"/etc/rabbitmq/enabled_plugins",

           enoent}

此时须要手动建立/etc/rabbitmq目录

[root@lugu-wugu-wxfile scripts]# mkdir /etc/rabbitmq

再次安装便可

[root@lugu-wugu-wxfile scripts]# ./rabbitmq-plugins enable rabbitmq_management

The following plugins have been enabled:

  mochiweb

  webmachine

  rabbitmq_web_dispatch

  amqp_client

  rabbitmq_management_agent

  rabbitmq_management

Applying plugin configuration to rabbit@lugu-wugu-wxfile... failed.

 * Could not contact node rabbit@lugu-wugu-wxfile.

   Changes will take effect at broker restart.

 * Options: --online  - fail if broker cannot be contacted.

            --offline - do not try to contact broker.

添加帐号

PS:默认帐号guest只能在localhost访问

[root@lugu-wugu-wxfile scripts]# ./rabbitmqctl add_user admin admin

 

Creating user "admin" …

设置管理员

[root@lugu-wugu-wxfile scripts]# ./rabbitmqctl set_user_tags admin administrator

 

Setting tags for user "admin" to [administrator] …

设置读写权限

命令使用户admin具备/vhost1这个virtual host中全部资源的配置、写、读权限以便管理其中的资源

首先须要建立/vhost1

[root@lugu-wugu-wxfile scripts]# ./rabbitmqctl add_vhost /vhost1

Creating vhost "/vhost1” .

[root@lugu-wugu-wxfile scripts]# ./rabbitmqctl set_permissions -p /vhost1 admin  '.*'  '.*'  '.*'

Setting permissions for user "admin" in vhost "/vhost1" …

而后就能够登陆web页面了

http://192.168.1.20:15672

相关文章
相关标签/搜索