关于 RabbitMQ 的安装,官方 文档里对不一样的操做系统的安装都介绍的很详细。
本文主要记录一下本人使用 macOS 安装时遇到的问题以及解决办法,方便之后查阅。
macOS Sierra,版本 10.12.6。html
使用 macOS 安装 RabbitMQ 很是方便,推荐使用 Homebrew 包管理器。git
若是本机没有安装 Homebrew(能够经过在终端输入 brew 指令来判断),请执行如下命令:github
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
回车便可。vim
因为须要下载国外的源,有可能会报 443的错误:浏览器
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
若是有fq工具打开fq工具便可暴力解决。bash
raw.githubusercontent.com
对应的 IP 地址:修改系统的host
文件微信
sudo vim /etc/hosts
打开 hosts 文件,将刚刚查询到的 IP 地址添加进去:curl
199.232.68.133 raw.githubusercontent.com
保存后,从新执行上面贴出的安装 Homebrew 命令。工具
#自动升级homebrew brew update #安装RabbitMQ server brew install rabbitmq
备注:ui
RabbitMQ 的运行须要依赖 Erlang 环境,使用此安装命令会自动帮咱们安装 Erlang 环境及其依赖,这就是使用 brew 的方便之处。
因为 brew 默认的官方更新源都是存放在 GitHub 上的,所以速度太慢常常会致使下载 Erlang 或其它依赖时常常下载失败:
Error: Failed to download resource "erlang" Download failed: https://homebrew.bintray.com/bottles/.....
最好的解决办法是更换成国内的镜像源。
Homebrew 的更新源由三部分组成:本体(brew.git)、核心(homebrew-core.git)以及二进制预编译包(homebrew-bottles),我这里使用的是中国科大的镜像。
1.替换brew.git
$ cd "$(brew --repo)" $ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
2.替换homebrew-core.git
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" $ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
3.替换homebrew-cask
$ cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask $ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
4.替换Homebrew Bottles源
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile $ source ~/.bash_profile
安装完成后能够用brew info rabbitmq
检查信息:
$ brew info rabbitmq rabbitmq: stable 3.8.3 Messaging broker https://www.rabbitmq.com /usr/local/Cellar/rabbitmq/3.8.3 (281 files, 20.4MB) Built from source on 2020-05-02 at 19:04:15 From: https://mirrors.ustc.edu.cn/homebrew-core.git/Formula/rabbitmq.rb ==> Dependencies Required: erlang ✔ ==> Caveats Management Plugin enabled by default at http://localhost:15672 Bash completion has been installed to: /usr/local/etc/bash_completion.d To have launchd start rabbitmq now and restart at login: brew services start rabbitmq Or, if you don't want/need a background service you can just run: rabbitmq-server ==> Analytics install: 9,648 (30 days), 33,180 (90 days), 137,570 (365 days) install-on-request: 9,471 (30 days), 32,348 (90 days), 132,710 (365 days) build-error: 0 (30 days)
浏览器访问http://localhost:15672,用户名和密码都是 guest:
欢迎你们关注个人微信公众号阅读更多文章: