目錄html
sudo yum install -y gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git
sudo vi /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://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc repo_gpgcheck=0 enabled=1
sudo yum install -y erlang
erl
yum install -y socat
官網下載地址:java
sudo rpm -Uvh https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.4/rabbitmq-server-3.7.4-1.el7.noarch.rpm
若是遇到erlang已安裝且版本正確,可是RabbitMQ檢測失敗的狀況 能夠追加參數 —nodeps (不驗證軟件包依賴)node
systemctl start rabbitmq-server systemctl status rabbitmq-server systemctl restart rabbitmq-server #設置爲開機啓動 systemctl enable rabbitmq-server
#增長rabbitMQ端口:5672 sudo firewall-cmd --add-port=5672/tcp --permanent #從新加載防火牆設置 sudo firewall-cmd --reload
#安裝web管理頁面插件(先啓動rabbitmq服務): rabbitmq-plugins enable rabbitmq_management #開放端口 sudo firewall-cmd --add-port=15672/tcp --permanent #從新加載防火牆配置 sudo firewall-cmd --reload
訪問安裝好的服務器下的rabbitmq:http://localhost:15672/ 帳號和密碼:guest guestc++
#添加用戶 sudo rabbitmqctl add_user admin passworld #設置用戶角色 sudo rabbitmqctl set_user_tags admin administrator #tag(administrator,monitoring,policymaker,management) #設置用戶權限(接受來自全部Host的全部操做) sudo rabbitmqctl set_permissions -p "/" admin '.*' '.*' '.*' #查看用戶權限 sudo rabbitmqctl list_user_permissions admin
#修改配置文件 sudo vi /etc/rabbitmq/rabbitmq.config #保存如下內容 [ {rabbit, [{tcp_listeners, [5672]}, {loopback_users, ["admin"]}]} ].
# 添加用戶 sudo rabbitmqctl add_user <username> <password> # 刪除用戶 sudo rabbitmqctl delete_user <username> # 修改用戶密碼 sudo rabbitmqctl change_password <username> <newpassword> # 清除用戶密碼(該用戶將不能使用密碼登錄,可是能夠經過SASL登錄若是配置了SASL認證) sudo rabbitmqctl clear_password <username> # 設置用戶tags(至關於角色,包含administrator,monitoring,policymaker,management) sudo rabbitmqctl set_user_tags <username> <tag> # 列出全部用戶 sudo rabbitmqctl list_users # 建立一個vhosts sudo rabbitmqctl add_vhost <vhostpath> # 刪除一個vhosts sudo rabbitmqctl delete_vhost <vhostpath> # 列出vhosts sudo rabbitmqctl list_vhosts [<vhostinfoitem> ...] # 針對一個vhosts給用戶賦予相關權限; sudo rabbitmqctl set_permissions [-p <vhostpath>] <user> <conf> <write> <read> # 清除一個用戶對vhosts的權限; sudo rabbitmqctl clear_permissions [-p <vhostpath>] <username> # 列出哪些用戶能夠訪問該vhosts; sudo rabbitmqctl list_permissions [-p <vhostpath>] # 列出用戶訪問權限; sudo rabbitmqctl list_user_permissions <username>