Installing Elasticsearch on OSX Mavericks

柔情痞子 提交于 2019-11-28 15:15:50

You should really consider using brew. It's a great tool that will take care of dependencies, version control and much more.

To install Elasticsearch using brew, simply:

brew update
brew install elasticsearch

Boom! Done.

After that follow Elasticsearch instructions :

  1. To have launchd start Elasticsearch at login:

    ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents
    
  2. Then to load Elasticsearch now:

    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
    

    Or, if you don't want/need launchctl, you can just run:

    elasticsearch
    

As there are not very good instructions for actually "installing" it onto a Mac:

Short Version:

  1. Install Java (prefer latest supported release)
  2. Set JAVA_HOME environment variable.
  3. Download Elasticsearch version (tar or zip).
  4. Extract Elasticsearch from the downloaded file.
  5. Run bin/elasticsearch from the extracted directory.

Long version:

  1. Download Java

    • Only need the JRE if you will not be writing code on the same machine.

    • I assume that you are getting the latest JDK, which is currently JDK 8 (as you appear to have, and I have installed working on my machine).

  2. Download and extract Elasticsearch and extract it into some directory.

    1. For example: mkdir -p ~/dev/elasticsearch
    2. Optionally move the downloaded file to there:

      mv Downloads/elasticsearch* ~/dev/elasticsearch

    3. Extract the downloaded file:

      cd ~/dev/elasticsearch (if you moved it in step 2)

      • If it's the zip, then unzip elasticsearch-1.1.0.zip (or if you don't want to cd into the directory, then just run unzip elasticsearch-1.1.0.zip -d ~/dev/elasticsearch)

      • If it's the tar, then tar -xvf elasticsearch-1.1.0.tar.gz (or if you don't want to cd into the directory, then just run tar -xvf elasticsearch-1.1.0.tar.gz -C ~/dev/elasticsearch)

    4. Cleanup (if you want) by removing the downloaded file:

      rm elasticsearch-1.1.0.*

  3. Open your .bash_profile file for your bash profile settings:

    vi ~/.bash_profile

  4. In the file, export your environment variable(s)

    export ES_HOME=~/dev/elasticsearch/elasticsearch-1.1.0

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home

    export PATH=$ES_HOME/bin:$JAVA_HOME/bin:$PATH

    • Close and re-open your Terminal OR

    • Run source ~/.bash_profile to update the environment variables

  5. Run Elasticsearch:

    elasticsearch

    • The more traditional way to run it is to do pretty much all of the above, but not add $ES_HOME/bin to the PATH. Then, just go to ES_PATH (cd $ES_PATH, then bin/elasticsearch) or run $ES_PATH/bin/elasticsearch.

Note: Do not setup your CLASSPATH without a very good reason. The scripts will do that for you.

  1. You should try to using brew with last update:

    brew update
    
  2. And install Cask java:

    brew cask install java
    
  3. After that you can install elasticsearch:

    brew install elasticsearch
    
  4. And to have launched start elasticsearch now use:

    brew services start elasticsearch
    

    Or you can just run:

    elasticsearch
    

To update ElasticSearch, just run brew upgrade elasticsearch

alytvynov

Update your java

brew update
brew cask install java

Install it with homebrew brew install elasticsearch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!