安装过程
官网提供了一个shell脚本,如下:
#!/bin/sh ## If sudo is not available on the system, ## uncomment the line below to install it # apt-get install -y sudo sudo apt-get update -y ## Install prerequisites sudo apt-get install curl gnupg -y ## Install RabbitMQ signing key curl -fsSL https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc | sudo apt-key add - ## Install apt HTTPS transport sudo apt-get install apt-transport-https ## Add Bintray repositories that provision latest RabbitMQ and Erlang 23.x releases sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list <<EOF deb https://dl.bintray.com/rabbitmq-erlang/debian bionic erlang deb https://dl.bintray.com/rabbitmq/debian bionic main EOF ## Update package indices sudo apt-get update -y ## Install rabbitmq-server and its dependencies sudo apt-get install rabbitmq-server -y --fix-missing
可以一行一行执行,整个过程很快;
启动过程及常用命令
# 启动 rabbitmq 服务 service rabbitmq-server start # 关闭 rabbitmq 服务 service rabbitmq-server stop # 重启 rabbitmq 服务 service rabbitmq-server restart # 查看 rabbitmq 状态 service rabbitmq-server status 注意,启动rabbitmq之后要启动管理服务插件,否则15672管理页面无法登录 # 启用 rabbitmq_manager sudo rabbitmq-plugins enable rabbitmq_management
其次,guest用户默认只能在localhost登录,所以我们需要创建一个新的用户:
##设置账号密码 [root@rabbitmq1 ebin]# rabbitmqctl add_user admin 123456 Adding user "admin" ... [root@rabbitmq1 ebin]# rabbitmqctl set_permissions -p / admin ".*" ".*" ".*" Setting permissions for user "admin" in vhost "/" ... [root@rabbitmq1 ebin]# rabbitmqctl set_user_tags admin administrator Setting tags for user "admin" to [administrator] ...
然后就可以进入管理页面了: