由于rabbitmq是基于erlang语言开发的,所以必须先安装erlang。
安装依赖: yum -y install gcc glibc-devel make ncurses-devel openssl-devel xmlto perl wget gtk2-devel binutils-devel
下载:wget http://erlang.org/download/otp_src_22.0.tar.gz
解压:tar -zxvf otp_src_22.0.tar.gz
移动:mv otp_src_22.0 /usr/local/
切换目录:cd /usr/local/otp_src_22.0/
创建安装目录:mkdir ../erlang
配置安装路径:./configure --prefix=/usr/local/erlang
安装:make install
查看是否安装成功:ll /usr/local/erlang/bin
添加环境变量:echo 'export PATH=$PATH:/usr/local/erlang/bin' >> /etc/profile
刷新环境变量:source /etc/profile
测试:erl
安装rabbitmq
下载:wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.15/rabbitmq-server-generic-unix-3.7.15.tar.xz
安装xz :yum install -y xz
第一次解压:/bin/xz -d rabbitmq-server-generic-unix-3.7.15.tar.xz
第二次解压:tar -xvf rabbitmq-server-generic-unix-3.7.15.tar
移动:mv rabbitmq_server-3.7.15/ /usr/local/
改名:mv /usr/local/rabbitmq_server-3.7.15 /usr/local/rabbitmq
配置环境变量:echo 'export PATH=$PATH:/usr/local/rabbitmq/sbin' >> /etc/profile
刷新环境变量:source /etc/profile
启动:rabbitmq-server -detached
停止:rabbitmqctl stop
状态:rabbitmqctl status
开启web插件:rabbitmq-plugins enable rabbitmq_management
访问:127.0.0.1:15672
默认账号密码:guest guest(这个账号只允许本机访问)
查看所有用户:rabbitmqctl list_users
添加一个用户:rabbitmqctl add_user test 123456
配置权限:rabbitmqctl set_permissions -p "/" test ".*" ".*" ".*"
查看用户权限:rabbitmqctl list_user_permissions test
设置tag:rabbitmqctl set_user_tags test administrator
删除默认用户:rabbitmqctl delete_user guest