RabbitMQ 是通过Erlang 开发的所以需要安装Erlang 环境
一、配置源
echo "deb https://dl.bintray.com/rabbitmq/debian trusty main" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list
echo "deb http://packages.erlang-solutions.com/ubuntu trusty contrib" | sudo tee -a /etc/apt/sources.list.d/erlang_solutions.list
二、导入对应的key
wget -c -O- http://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo apt-key add -
wget -O- https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc |sudo apt-key add -
三、开始安装erlang和RabbitMQ
sudo apt-get update
sudo apt-get install erlang-nox
sudo apt-get install rabbitmq-server
四、RabbitMQ 操作
sudo service rabbitmq-server start # 启动
sudo service rabbitmq-server stop # 停止
sudo service rabbitmq-server restart # 重启
sudo service rabbitmq-server status # 查看当前状态
五、配置RabbitMQ
- 添加admin用户 设置密码
sudo rabbitmqctl add_user admin admin
- 赋予权限
sudo rabbitmqctl set_user_tags admin administrator
- 赋予virtual host中所有资源的配置、写、读权限以便管理其中的资源
sudo rabbitmqctl set_permissions -p / admin '.*' '.*' '.*'
六、管理RabbitMQ
- 开启web管理页面
sudo rabbitmq-plugins enable rabbitmq_management