brew tapを用いてElasticsearch2.4とelasticsearch-headをMacにインストール
前提
- OS
- macOS Sierra
- Homebrewのバージョン
- 1.1.9
概要
Elasticsearchをbrewでインストールすると、デフォルトでバージョン5がインストールされたが、
https://github.com/mobz/elasticsearch-headを確認すると、
for Elasticsearch 5.x: site plugins are not supported. Run as a standalone server
とのことなので、
brew tapを用いて過去のバージョンの2.4とelasticsearch-headをインストールする。
手順
1. Elasticsearch2.4のインストール
brew tap homebrew/versions brew search elasticsearch
で
elasticsearch elasticsearch@1.7 elasticsearch@2.4
過去のelasticsearchのパッケージが確認出来るので、
brew install elasticsearch@2.4
でElasticsearch2.4をインストールする。
次に、
ln -sfv /usr/local/opt/elasticsearch\@2.4/homebrew.mxcl.elasticsearch\@2.4.plist launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch\@2.4.plist
で自動起動の設定を行う。
2. PATHの設定
brew info elasticsearch@2.4
を実行すると
Data: /usr/local/var/elasticsearch/elasticsearch_HirofumiYamamoto/ Logs: /usr/local/var/log/elasticsearch/elasticsearch_HirofumiYamamoto.log Plugins: /usr/local/opt/elasticsearch@2.4/libexec/plugins/ Config: /usr/local/etc/elasticsearch/ plugin script: /usr/local/opt/elasticsearch@2.4/libexec/bin/plugin
と記述されている部分が見つかるのでこれを参考にPATHを通しておく。
今回はpluginコマンドでelasticsearch-headをインストールするので、
echo 'export PATH="/usr/local/opt/elasticsearch@2.4/libexec/bin:$PATH"' >> ~/.bash_profile
で.bash_profileを更新しPATHを通す。
source ~/.bash_profile
で.bash_profileを再度読み込みしておく。
3. elasticsearch-headのインストール
plugin install mobz/elasticsearch-head
でelasticsearch-headをインストールする。