Installing and starting Elasticsearch

Go to elastic.co/downloads/elasticsearch and download the latest Elasticsearch version for your machine. For Ubuntu, we can download the official .deb package and install using dpkg:

$ sudo dpkg -i elasticsearch-6.3.2.deb
Your version of Elasticsearch might be different from the one here. That's fine.

Next, we need to configure Elasticsearch to use the Java version we just installed. We have already done this for the entire system, but Elasticsearch also has its own configuration file for specifying the path to the Java binaries. Open up the /etc/default/elasticsearch file and add an entry for the JAVA_HOME variable, just as you did before:

# Elasticsearch Java pathJAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 ...

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.