1.修改 /etc/apt/sources.list
sudo vim /etc/apt/sources.list
#文件最后添加
deb https://packages.erlang-solutions.com/ubuntu trusty contrib
#保存退出
2.Erlang Solutions公钥以apt-secure
wget https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc
sudo apt-key add erlang_solutions.asc
3.安装Erlang
sudo apt-get update
sudo apt-get install esl-erlang
4.Erlang版本固定(以20.1.7为例)
cd /etc/apt/preferences.d/
sudo vim erlang
# /etc/apt/preferences.d/erlang
Package: erlang*
Pin: version 1:20.1-1
Pin-Priority: 1000
Package: esl-erlang
Pin: version 1:20.1.7
Pin-Priority: 1000
#保存退出
5.安装rabbitmq
echo "deb https://dl.bintray.com/rabbitmq/debian xenial main" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list
wget -O- https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc |
sudo apt-key add -
sudo apt-get update
sudo apt-get install rabbitmq-server
6.远程访问
cd /etc/rabbitmq
sudo vim rabbitmq-env.conf
# Defaults to rabbit. This can be useful if you want to run more than one node
# per machine - RABBITMQ_NODENAME should be unique per erlang-node-and-machine
# combination. See the clustering on a single machine guide for details:
# http://www.rabbitmq.com/clustering.html#single-machine
NODENAME=rabbit
# By default RabbitMQ will bind to all interfaces, on IPv4 and IPv6 if
# available. Set this if you only want to bind to one network interface or#
# address family.
NODE_IP_ADDRESS=0.0.0.0
# Defaults to 5672.
NODE_PORT=5672
sudo service rabbitmq-server restart
7.创建用户
rabbitmqctl add_user admin admin
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
8.远程登录测试
rabbitmq-plugins enable rabbitmq_management
用刚刚创建的admin用户登录 若登录成功说明可以远程使用rabbitmq
9.如何使用创建用户发送消息到rabbitmq
将guest修改成你创建时的账号密码