安装方式---brew
我们知道mac下安装软件通过brew安装是非常方便的一种方式,接下来我们通过brew进行安装RabbitMQ
安装步骤
1.打开终端输入brew install rabbitmq
shizhengyangdeMacBook-Pro:~ panyuanyuan$ brew install rabbitmq
Updating Homebrew...
当安装完毕后显示如下
==> 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.6.9: 193 files, 5.3MB, built in 22 seconds
2.启动RabbitMQ
通过上面的显示知道,我们的安装路径是/usr/local/Cellar/rabbitmq/3.6.9,接下来进入到安装路径并启动
shizhengyangdeMacBook-Pro:~ panyuanyuan$ cd /usr/local/Cellar/rabbitmq/3.6.9/sbin/
shizhengyangdeMacBook-Pro:sbin panyuanyuan$ ./rabbitmq-server
3.查看启动
这样我们就启动了RabbitMQ,接下来查看启动,
打开浏览器输入http://localhost:15672,进行登录,用户名和密码都是guest
登录后看到如下界面,至此安装启动完毕
配置环境变量(可选)---知其所以然
首先我们需要明白配置环境变量的作用是什么?
其实配置环境变量是为了更方便为我们去找到安装的RabbitMQ
配置步骤
将/usr/local/sbin添加到$PATH,可以将下面这两行加到~/.bash_profile,如果没有此文件,则新建一个即可:
shizhengyangdeMacBook-Pro:~ panyuanyuan$ vim ~/.bash_profile
编辑完后:wq保存退出,使环境变量立即生效
# RabbitMQ Config
export PATH=$PATH:/usr/local/sbin
刷新配置文件使其立马生效
shizhengyangdeMacBook-Pro:~ panyuanyuan$ source ~/.bash_profile
启动服务
shizhengyangdeMacBook-Pro:~ panyuanyuan$ rabbitmq-server
RabbitMQ 3.6.9. Copyright (C) 2007-2016 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-sasl.log
##########
Starting broker...
completed with 10 plugins.