Failed installing elasticsearch

I am following the guide here https://logz.io/blog/elasticsearch-tutorial/ on a brand new ubuntu 18.04 AWS EC2 instance.

I ran the following commands:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
sudo apt-get update
sudo apt-get install elasticsearch

And receive the following error:

dpkg: error processing archive /var/cache/apt/archives/elasticsearch_6.4.2_all.deb (--unpack):
 new elasticsearch package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/elasticsearch_6.4.2_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Any ideas?

Have you installed java first? Check for JAVA_HOME environment variable and/or run java -version.

Make sure you install java 8.
hope this helps you,

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.