1.安装rabitMq之前需要安装Erlang
cd /usr/local/
wget http://erlang.org/download/otp_src_18.3.tar.gz
tar -zxvf otp_src_18.3.tar.gz
cd otp_src_18.3
# 创建Erlang安装目录
mkdir /usr/local/erlang
# ErLang安装依赖
yum install -y gcc gcc-c++ unixODBC-devel openssl-devel ncurses-devel perl
./configure --prefix=/usr/local/erlang
make && make install
# 配置Erlang环境变量
vim /etc/profile
文件末尾添加 export PATH=$PATH:/usr/local/erlang/bin
source /etc/profile
2.rabbitMq安装
wget https://www.rabbitmq.com/releases/rabbitmq-server/current/rabbitmq-server-generic-unix-3.6.15.tar.xz
xz -d rabbitmq-server-generic-unix-3.6.15.tar.xz
tar -xvf rabbitmq-server-generic-unix-3.6.15.tar
# 我将目录放到/usr/local/rabbitmq_server下
mv rabbitmq_server-3.6.15/ /usr/local/rabbitmq_server
3.配置网页插件
rabbitmq-plugins enable rabbitmq_management
# 启动rabbitMq
rabbitmq-server –detached
# Tips:rabbitmq默认会创建guest账号,只能用于localhost登录页面管理员
# 添加admin用户并且密码为admin
rabbitmqctl add_user admin admin
# 授权admin用户为管理员
rabbitmqctl set_user_tags admin administrator
# 授权访问权限
rabbitmqctl set_permissions -p "/" admin "." "." ".*"
4.验证rabbitMq是否安装成功
访问网址:http:IP:15672 (默认端口) 用户名就是上一步创建admin,(如果用guest账户,只能在本机也就是localhost下登陆)
5.rabbit常用命令
启动:rabbitmq-server –detached 查看服务状态:rabbitmqctl status 关闭服务:rabbitmqctl stop 查看所有用户:rabbitmqctl list_users 添加用户:rabbitmqctl add_user admin admin 授权用户管理员:rabbitmqctl set_user_tags admin administrator 授权访问权限:rabbitmqctl set_permissions -p "/" admin "." "." ".*" 添加虚拟机:rabbitmqctl add_vhost admin_vhost 授权用户到虚拟机:rabbitmqctl set_permissions -p admin_vhost admin ".*" ".*" ".*"
引用地址: https://cloud.tencent.com/developer/article/1403739