RabbitMQ部署
系統環境:CentOs7
1.因爲RabbitMQ是基於Erlang語言開發,因此在安裝RabbitMQ以前,須要先安裝Erlang
[root@localhost /]# cd usr/local/src/
[root@localhost src]# wget
2. 執行下面命令升級上步下載的rpm軟件包
[root@localhost /]# rpm -ivh erlang-19.0.4-1.el7.centos.x86_64.rpm
3. 執行下面命令安裝erlang
[root@localhost /]# yum -y install erlang
4. 測試Erlang是否安裝成功
[root@localhost /]# erl -version
5. 安裝RabbitMQ
[root@localhost /]# wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el6.noarch.rpm
[root@localhost /]# yum -y install rabbitmq-server-3.6.6-1.el6.noarch.rpm
6. 後臺運行RabbitMQ
[root@localhost /]# rabbitmq-server -detached
![](http://static.javashuo.com/static/loading.gif)
這裏提示咱們: 警告: 沒有寫入 PID 文件;-分離經過 #直接下一步
設爲開機啓動
[root@localhost /]# chkconfig rabbitmq-server on
![](http://static.javashuo.com/static/loading.gif)
7. 啓動RabbitMQ服務
[root@localhost /]# cd ../../sbin/
[root@localhost /]# service rabbitmq-server start
![](http://static.javashuo.com/static/loading.gif)
8. 安裝插件
查看目前RabbitMQ已安裝插件
[root@localhost /]# ./rabbitmq-plugins list
![](http://static.javashuo.com/static/loading.gif)
9. 安裝web管理端
[root@localhost /]# rabbitmq-plugins enable rabbitmq_management
![](http://static.javashuo.com/static/loading.gif)
10. 登錄查看,新建一個用戶名爲admin,密碼爲yunwei的用戶,並授予管理員(administrator)權限
[root@localhost /]# rabbitmqctl add_user admin yunwei
[root@localhost /]# rabbitmqctl set_user_tags admin administrator
![](http://static.javashuo.com/static/loading.gif)
11. 經過瀏覽器訪問Server端地址: 192.168.4.182:15672 輸入剛纔建立的用戶名密碼進行登陸
![](http://static.javashuo.com/static/loading.gif)
以下圖,RabbitMQ就算搭建完成了,別急,還有受權操做
![](http://static.javashuo.com/static/loading.gif)
12. 設置權限
[root@localhost /]# rabbitmqctl add_vhost admin
[root@localhost /]# rabbitmqctl set_permissions -p admin admin ".*" ".*" ".*"
![](http://static.javashuo.com/static/loading.gif)
本文來自 http://note.youdao.com/noteshare?id=375089b4407b10c67bda5f0a842013aeweb