rabbitmq部署记录一
部署环境说明:centos7.2
1.安装依赖库&模块
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel
ncurses模块安装如下
yum install perl
yum -y install ncurses-devel
yum install ncurses-devel
2.安装erlang
说明:rabbitmq依赖erlang
2.1上传部署包并解压
上传otp_src_18.2.1.tar.gz并解压到/opt目录下
cd /;mkdir /home/erlang
cd /opt/otp_src_18.2.1;chmod +x *;./configure --prefix=/home/erlang
成功的标志:
********************** APPLICATIONS DISABLED **********************
jinterface : No Java compiler found
odbc : ODBC library - link check failed
********************** APPLICATIONS INFORMATION *******************
wx : wxWidgets not found, wx will NOT be usable
********************** DOCUMENTATION INFORMATION ******************
documentation :
fop is missing.
Using fakefop to generate placeholder PDF files.
2.2编译并安装
cd /opt/otp_src_18.2.1 && make -j4 && make install
2.3添加环境变量并生效
/etc/profile文件,增加下面的环境变量
vim /etc/profile
ERL_HOME=/home/erlang
PATH=$ERL_HOME/bin:$PATH
export ERL_HOME PATH
生效#source /etc/profile
2.4测试验证
whereis erlang
erlang: /usr/local/erlang
erl
Erlang/OTP 18 [erts-7.2.1] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V7.2.1 (abort with ^G)
3.rabbitmq安装
3.1准备工作
安装python2.7.5
yum -y install xmlto
解压rabbitmq-server-generic-unix-3.6.9.tar.xz到/home目录下为rabbitmq_server-3.6.9
软连接
cd /;ln -s /home/rabbitmq_server-3.6.9 /home/rabbitmq
3.2添加环境变量
vim /etc/profile
rabbitmq
export RABBITBIN=/home/rabbitmq/sbin
export PATH=$PATH:$RABBITBIN
生效#source /etc/profile
3.3编写启动脚本并启动
cd /home/rabbitmq;vim start.sh
!/bin/bash
sbin/rabbitmq-server start &
cd /home/rabbitmq && ./start.sh
rabbitmq_server-3.6.9/sbin]# ls
rabbitmqctl rabbitmq-defaults rabbitmq-env rabbitmq-plugins rabbitmq-server
netstat -tnlp | grep 5672端口
3.4添加用户并授权
添加用户:rabbitmqctl add_user admin admin
添加权限:rabbitmqctl set_permissions -p "/" admin "." "." ".*"
修改用户角色:rabbitmqctl set_user_tags admin administrator
./rabbitmqctl add_user admin admin
Creating user "admin" ...
[root@localhost sbin]# ./rabbitmqctl set_permissions -p "/" admin "." "." ".*"
Setting permissions for user "admin" in vhost "/" ...
[root@localhost sbin]# ./rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...
3.5删除guest用户
rabbitmqctl delete_user guest
3.6修改admin用户密码为123456
rabbitmqctl change_password admin 123456
查看当前用户列表
rabbitmqctl list_users
Listing users ...
admin [administrator]
3.7启动网页管理
开启网页控制台
cd /home/rabbitmq/sbin;./rabbitmq-plugins enable rabbitmq_management
浏览器输入192.168.1.2:15672 使用账号admin 密码123456登陆成功
注意:如果登陆失败则要检查自己的防火墙有没有放开端口15672