1.此环境为CentOS
2.所有安装在目录/var/erlang/,注意安装目录,以及环境配置目录
yum -y install gcc glibc-devel make ncurses-devel openssl-devel xmlto perl wget
1.下载erlang包,可能会等待很久:
wget http://www.erlang.org/download/otp_src_18.3.tar.gz
2.解压.gz包:
tar -xzvf otp_src_18.3.tar.gz
3.切换到安装路径:
cd otp_src_18.3
4.生产安装配置:
./configure --prefix=/var/erlang/
5.编辑安装:
make && make install
1.打开/etc/profile文件,添加环境变量:
# 在文件最下面,添加以下内容
ERL_HOME=/var/erlang
PATH=$ERL_HOME/bin:$PATH
export ERL_HOME PATH
2.将配置文件及时生效:
source /etc/profile
3.测试是否成功,输出erl,如果出现以下内容,说明安装成功,ctrl + c 退出即可:
erl
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V7.3 (abort with ^G)
1>
1.下载解压,切换cd /var/erlang目录:
cd /var/erlang
2.下载RabbitMQ安装包:
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-generic-unix-3.6.1.tar.xz
3.解压安装包:
xz -d rabbitmq-server-generic-unix-3.6.1.tar.xz //解压.xz包
tar -xvf rabbitmq-server-generic-unix-3.6.1.tar //解压.tar包
1.打开/etc/profile文件,添加环境变量:
vim /etc/profile
# 将下面的配置到此文件中
# set rabbitmq environment
export PATH=$PATH:/var/erlang/rabbitmq_server-3.6.1/sbin
2.将配置文件及时生效:
source /etc/profile
1.启动服务器:
rabbitmq-server -detached // -detached 代表后台守护进程方式启动
Warning: PID file not written; -detached was passed.
2.查看状态,rabbitmqctl status:
rabbitmqctl status
Status of node rabbit@bogon ...
[{pid,60340},
{running_applications,[{rabbit,"RabbitMQ","3.6.1"},
{mnesia,"MNESIA CXC 138 12","4.13.3"},
{os_mon,"CPO CXC 138 46","2.4"},
{xmerl,"XML parser","1.3.10"},
{rabbit_common,[],"3.6.1"},
{ranch,"Socket acceptor pool for TCP protocols.",
"1.2.1"},
{sasl,"SASL CXC 138 11","2.7"},
{stdlib,"ERTS CXC 138 10","2.8"},
{kernel,"ERTS CXC 138 10","4.2"}]},
{os,{unix,linux}},
{erlang_version,"Erlang/OTP 18 [erts-7.3] [source] [64-bit] [async-threads:64] [hipe] [kernel-poll:true]\n"},
{memory,[{total,41120288},
{connection_readers,0},
{connection_writers,0},
{connection_channels,0},
{connection_other,0},
{queue_procs,2680},
{queue_slave_procs,0},
{plugins,0},
{other_proc,18556136},
{mnesia,58040},
{mgmt_db,0},
{msg_index,51280},
{other_ets,876520},
{binary,19800},
{code,17392319},
{atom,662409},
{other_system,3501104}]},
{alarms,[]},
{listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
{vm_memory_high_watermark,0.4},
{vm_memory_limit,764020326},
{disk_free_limit,50000000},
{disk_free,12359073792},
{file_descriptors,[{total_limit,924},
{total_used,2},
{sockets_limit,829},
{sockets_used,0}]},
{processes,[{limit,1048576},{used,137}]},
{run_queue,0},
{uptime,951},
{kernel,{net_ticktime,60}}]
3.关闭服务器:
rabbitmqctl stop
# 在/etc/rabbitmq 新创建目录
erlang mkdir /etc/rabbitmq
1.启动插件:
rabbitmq-plugins enable rabbitmq_management // rabbitmq_management插件名
rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
mochiweb
webmachine
rabbitmq_web_dispatch
amqp_client
rabbitmq_management_agent
rabbitmq_management
Applying plugin configuration to rabbit@bogon... started 6 plugins.
2.关闭插件:
rabbitmq-plugins disable rabbitmq_management
1.添加用户,后面两个参数分别是用户名、密码:
# 创建用户名为root、密码是 lv6913540
rabbitmqctl add_user root lv6913540
Creating user "root" ...
2.新创建用户,赋予administrator角色,否则登录失败:
# 给用户名为root的添加 administrator权限
rabbitmqctl set_user_tags root administrator
3.创建rabbitMQ监控用户,负责整个MQ的监控:
rabbitmqctl add_user lvhuiqi lvhuiqi
rabbitmqctl set_user_tags lvhuiqi monitoring // 执行命令
4.查看当前用户列表,以及负责的角色:
rabbitmqctl list_users // 执行命令
Listing users ...
lvhuiqi [monitoring] // 监控权限
guest [administrator]
root [administrator] // 管理员权限
5.删除用户:
rabbitmqctl delete_user Username
6.修改用户的密码:
rabbitmqctl change_password Username Newpassword
注意:登录时,必须给新创建的用户赋予角色,否则用户无权登录。
http://[ip地址]:15672
,注意环境的防火墙是否关闭。