1、安装
在Mac下安装RabbitMQ是非常简单的,一般默认RabbitMQ服务器依赖的Erlang已经安装,只需要用下面两个命令就可以完成RabbitMQ的安装(前提是homebrew已经被安装 见https://brew.sh/):
2、使用brew来安装 RabbitMQ
brew install rabbitmq
看到如下的代码表示RabbitMQ安装成功
localhost:~ allenlee$ brew install rabbitmq
==> Installing dependencies for rabbitmq: openssl, jpeg, libpng, libtiff, wxmac and erlang
==> Installing rabbitmq dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2q.high_sierra.bott
######################################################################## 100.0%
==> Pouring openssl-1.0.2q.high_sierra.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
If you need to have openssl first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
==> Summary
? /usr/local/Cellar/openssl/1.0.2q: 1,794 files, 12.1MB
==> Installing rabbitmq dependency: jpeg
==> Downloading https://homebrew.bintray.com/bottles/jpeg-9c.high_sierra.bottle.tar.
######################################################################## 100.0%
==> Pouring jpeg-9c.high_sierra.bottle.tar.gz
? /usr/local/Cellar/jpeg/9c: 21 files, 724.6KB
==> Installing rabbitmq dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.35.high_sierra.bottl
######################################################################## 100.0%
==> Pouring libpng-1.6.35.high_sierra.bottle.tar.gz
? /usr/local/Cellar/libpng/1.6.35: 26 files, 1.2MB
==> Installing rabbitmq dependency: libtiff
==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.10.high_sierra.bott
######################################################################## 100.0%
==> Pouring libtiff-4.0.10.high_sierra.bottle.tar.gz
? /usr/local/Cellar/libtiff/4.0.10: 246 files, 3.5MB
==> Installing rabbitmq dependency: wxmac
==> Downloading https://homebrew.bintray.com/bottles/wxmac-3.0.4_1.high_sierra.bottl
######################################################################## 100.0%
==> Pouring wxmac-3.0.4_1.high_sierra.bottle.tar.gz
? /usr/local/Cellar/wxmac/3.0.4_1: 813 files, 23.8MB
==> Installing rabbitmq dependency: erlang
==> Downloading https://homebrew.bintray.com/bottles/erlang-21.1.4.high_sierra.bottl
######################################################################## 100.0%
==> Pouring erlang-21.1.4.high_sierra.bottle.tar.gz
==> Caveats
Man pages can be found in:
/usr/local/opt/erlang/lib/erlang/man
Access them with `erl -man`, or add this directory to MANPATH.
==> Summary
? /usr/local/Cellar/erlang/21.1.4: 5,672 files, 272.4MB
==> Installing rabbitmq
==> Downloading https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.9/rabb
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/9245
######################################################################## 100.0%
==> /usr/bin/unzip -qq -j /usr/local/Cellar/rabbitmq/3.7.9/plugins/rabbitmq_management-3.
==> 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
==> Summary
? /usr/local/Cellar/rabbitmq/3.7.9: 234 files, 13.4MB, built in 57 seconds
==> Caveats
==> openssl
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
If you need to have openssl first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
==> erlang
Man pages can be found in:
/usr/local/opt/erlang/lib/erlang/man
Access them with `erl -man`, or add this directory to MANPATH.
==> rabbitmq
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
localhost:~ allenlee$
安装目录:/usr/local/Cellar/rabbitmq/3.7.9
3、配置环境
可以将下面这两行加到~/.bash_profile:
# RabbitMQ
PATH=$PATH:/usr/local/Cellar/rabbitmq/3.7.9/sbin
编辑完后:wq保存退出,使环境变量立即生效。
source ~/.bash_profile
4、RabbitMQ 的启动
localhost:3.7.9 allenlee$ rabbitmq-server
## ##
## ## RabbitMQ 3.7.9. Copyright (C) 2007-2018 Pivotal Software, Inc.
########## Licensed under the MPL. See http://www.rabbitmq.com/
###### ##
########## Logs: /usr/local/var/log/rabbitmq/rabbit@localhost.log
/usr/local/var/log/rabbitmq/rabbit@localhost_upgrade.log
Starting broker...
completed with 6 plugins.
则执行:sudo ./rabbitmq-server
或
localhost:~ allenlee$ cd /usr/local/Cellar/rabbitmq/3.7.9/sbin
localhost:3.7.9 allenlee$ sudo rabbitmq-server
5、登陆管理界面
在浏览器输入:http://localhost:15672/
默认账户和密码都是:guest