1.安裝rabitMq以前須要安裝Erlangc++
cd /usr/local/
wget http://erlang.org/download/otp_src_18.3.tar.gz
tar -zxvf otp_src_18.3.tar.gz
cd otp_src_18.3
# 建立Erlang安裝目錄
mkdir /usr/local/erlang
# ErLang安裝依賴
yum install -y gcc gcc-c++ unixODBC-devel openssl-devel ncurses-devel perl
./configure --prefix=/usr/local/erlang
make && make install
# 配置Erlang環境變量
vim /etc/profile
文件末尾添加 export PATH=$PATH:/usr/local/erlang/bin
source /etc/profile
2.rabbitMq安裝vim
wget https://www.rabbitmq.com/releases/rabbitmq-server/current/rabbitmq-server-generic-unix-3.6.15.tar.xz
xz -d rabbitmq-server-generic-unix-3.6.15.tar.xz
tar -xvf rabbitmq-server-generic-unix-3.6.15.tar
# 我將目錄放到/usr/local/rabbitmq_server下
mv rabbitmq_server-3.6.15/ /usr/local/rabbitmq_server
3.配置網頁插件spa
rabbitmq-plugins enable rabbitmq_management
# 啓動rabbitMq
rabbitmq-server –detached
# Tips:rabbitmq默認會建立guest帳號,只能用於localhost登陸頁面管理員
# 添加admin用戶而且密碼爲admin
rabbitmqctl add_user admin admin
# 受權admin用戶爲管理員
rabbitmqctl set_user_tags admin administrator
# 受權訪問權限
rabbitmqctl set_permissions -p "/" admin "." "." ".*"
4.驗證rabbitMq是否安裝成功插件
訪問網址:http:IP:15672 (默認端口) 用戶名就是上一步建立admin,(若是用guest帳戶,只能在本機也就是localhost下登錄)
5.rabbit經常使用命令unix
啓動:rabbitmq-server –detached 查看服務狀態:rabbitmqctl status 關閉服務:rabbitmqctl stop 查看全部用戶:rabbitmqctl list_users 添加用戶:rabbitmqctl add_user admin admin 受權用戶管理員:rabbitmqctl set_user_tags admin administrator 受權訪問權限:rabbitmqctl set_permissions -p "/" admin "." "." ".*" 添加虛擬機:rabbitmqctl add_vhost admin_vhost 受權用戶到虛擬機:rabbitmqctl set_permissions -p admin_vhost admin ".*" ".*" ".*"
引用地址: https://cloud.tencent.com/developer/article/1403739 code