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
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 ...