ubuntu 20.04安装rabbitmq

2022/2/21 7:28:46

本文主要是介绍ubuntu 20.04安装rabbitmq,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

安装过程
官网提供了一个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] ...

然后就可以进入管理页面了:



这篇关于ubuntu 20.04安装rabbitmq的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程