## 安装 Erlang
### 源码安装
```bash
tar zxvf otp_src_XX.XX.tar.gz
cd otp_src_XX.XX.tar.gz
./configure --prefix=/opt/erlang
make
make install
```
### 配置环境变量
```shell
ERLANG_HOME=/opt/erlang
export PATH=$PATH:$ERLANG_HOME/bin
export ERLANG_HOME
source /etc/profile
```
## 安装RabbitMQ
### 解压二进制包
```shell
tar zvxf rabbitmq-server-generic-unix-x.x.xx.tar.gz -C /opt
cd /opt
mv rabbitmq-server-generic-unix-x.x.xx rabbitmq
```
### 配置环境变量
```shell
export PATH=$PATH:/opt/rabbitmq/sbin
export RABBITMQ_HOME=/opt/rabbitmq
source /etc/profile
```
## 简单使用
- 运行
```shell
rabbitmq-server -detached #后台运行
```
- 查看状态
```sh
rabbitmqctl status
```
- 查看集群信息
```shell
rabbitmqctl cluster_status
```
- 添加新用户(默认guest只能通过本地localhost])
```shell
rabbitmqctl add_user root root123
```
- 为root用户设置权限
```shell
rabbitmqctl set_permissions -p / root ".*" ".*" ".*"
```
- 设置root用户为管理员角色
```shell
rabbitmqctl set_user_tags_root administrator
```