感谢此兄: https://blog.51cto.com/huwei555/2341513?source=dra (centos7 安装rabbitmq 3.7)
以root用户登录。
cd /home/soft
安装依赖包
yum -y update
yum install gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel xmlto unixODBC-devel -y 安装各种依赖
wget –no-cache http://www.convirture.com/repos/definitions/rhel/6.x/convirt.repo -O /etc/yum.repos.d/convirt.repo 设置socat依赖包
yum makecache
yum install socat 安装socat依赖
安装erlang依赖
wget https://github.com/rabbitmq/erlang-rpm/releases/download/v20.3.8.17/erlang-20.3.8.17-1.el7.centos.x86_64.rpm 从github获取最新版erlang,避免版本太小不支持rabbitmq
rpm -ivh erlang-20.3.8.17-1.el7.centos.x86_64.rpm 安装erlang,注意rabbitmq依赖erlang19.3以上版本
./erl 然后输入’halt().’退出即可。测试是否安装成功。
验证安装:
[root@localhost soft]# erl
Erlang/OTP 20 [erts-9.3.3.7] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false] Eshell V9.3.3.7 (abort with ^G)
1> 7+10.
17
2> halt().
[root@localhost soft]# rpm -qa|grep erlang
erlang-20.3.8.17-1.el7.centos.x86_64
[root@localhost soft]#
安装rabbitmq3.7.9
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.9/rabbitmq-server-3.7.9-1.el7.noarch.rpm
rpm -ivh rabbitmq-server-3.7.9-1.el7.noarch.rpm
systemctl status rabbitmq-server.service 查看状态
systemctl start rabbitmq-server.service 启动
systemctl stop rabbitmq-server.service 停止
验证安装:
[root@localhost soft]# rpm -qa|grep rabbitmq-server
rabbitmq-server-3.7.9-1.el7.noarch
配置网页访问RabbitMQ
rabbitmqctl add_user joyce joyce 添加新用户名密码
Adding user "joyce" ...
rabbitmqctl set_permissions -p "/" joyce '.*' '.*' '.*' 赋予用户权限命令
Setting permissions for user "joyce" in vhost "/" ...
rabbitmqctl set_user_tags joyce administrator 赋予用户角色命令
Setting tags for user "joyce" to [administrator] ...
rabbitmqctl list_users 查看RabbitMQ中用户命令
Listing users ...
user tags
guest [administrator]
joyce [administrator]
rabbitmq-plugins enable rabbitmq_management 开启rabbitmq管理控制台命令
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@localhost...
The following plugins have been enabled:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch started 3 plugins.
浏览器端访问rabbitmq
http://IP:15672 输入用户名密码: joyce joyce
centos7上rabbit常用命令
[root@localhost soft]# rabbitmqctl list_queues 查看queue队列
Timeout: 60.0 seconds ...
Listing queues for vhost / ...
name messages
hello 0
[root@localhost soft]# rabbitmqctl list_queues name messages_ready messages_unacknowledged 查看未ack确认的队列和消息数
Timeout: 60.0 seconds ...
Listing queues for vhost / ...
name messages_ready messages_unacknowledged
model2-work-manual-ack 0 0
model2-work 0 0
hello 1 0