前言
今天安装zookeeper时使用的是brew方式来安装,才深深的体会到brew的厉害之处,闲话少叙,进入正题。
Homebrew的使用
1. 安装Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
在1中指令回车之后,会提示Press RETURN to continue or any other key to abort
(回车继续或者按其他键终止),这是直接回车进入“Downloading and installing Homebrew…”,
- 如果网络不好的话可能会提示“fatal: unable to access ‘https://github.com/Homebrew/brew/’: SSLRead() return error -9806…等”,没关系重新输入1的指令更新。
- 用如下命令下载安装msf时,提示
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
解决办法:
- 打开 https://www.ipaddress.com/ 输入访问不了的域名,获得对应的IP。
- 使用vim /etc/hosts命令打开不能访问的机器的hosts文件,添加如下内容:
199.232.68.133 raw.githubusercontent.com
199.232.68.133 user-images.githubusercontent.com
199.232.68.133 avatars2.githubusercontent.com
199.232.68.133 avatars1.githubusercontent.com
注:上面内容中199.232.68.133是raw.githubusercontent.com所在的服务器IP(通过 https://www.ipaddress.com/ 获知)。
保存该文件,再使用即可正常访问。
正常安装完成之后会有如下提示:
HEAD is now at 2b6f47714 Merge pull request #4116 from commitay/zap-force
==> Cleaning up /Library/Caches/Homebrew...
==> Migrating /Library/Caches/Homebrew to /Users/maerfeifei/Library/Caches/Homeb
==> Deleting /Library/Caches/Homebrew...
Already up-to-date.
==> Installation successful!
==> Homebrew has enabled anonymous aggregate user behaviour analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics.html
==> Next steps:
- Run `brew help` to get started
- Further documentation:
https://docs.brew.sh
2. brew 常用命令(SoftwareName是你需要处理的软件的软件名)
- 查看软件最新版本,
brew info SoftwareName
例如
brew info zookeeper
- 安装软件,
brew install SoftwareName
例如
brew install zookeeper
- 卸载软件:
rew remove SoftwareName
例如
brew remove zookeeper
- 查看通过brew安装的所有软件
brew list
查看某个软件的安装路径
brew list 软件名