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

相關文章
相關標籤/搜索