1、安裝JDK8
參考:Ubuntu 安裝 JDK 7 / JDK8 的兩種方式
注:ElasticSearch 5.2.0需要JDK8,可以只裝JDK8。
2、下載elasticsearch-5.2.0.tar.gz
3、解壓到/opt/elasticsearch-5.2.0
4、到/opt/elasticsearch-5.2.0/bin目錄下運行:./elasticsearch -v
5、打開新的terminal,運行curl -X GET 'http://localhost:9200'應該可以成功查到默認信息
6、此時,只可以在本機訪問ES,如果需要外網訪問,按照網上找到的很多解決方法都不能成功,這一步花了我很長時間。
解決方法參考:Bootstrap Error
引用如下:
We've just patched the docs to explain a way to opt out that ought to work fine for you. It might take a while to build so here is a link to the fix: https://github.com/elastic/elasticsearch/pull/21220/files227
Essentially, set http.host
to the
non-local IP while keeping network.host
at
its default. You can't form a cluster but you can test against a single node. If you want a cluster you'll need to make the bootstrap checks happy.