3

I'm running a vagrant box which runs ubuntu inside a vm (using Laravel Homestead box)

I'm trying to install the Elastic App-search product.

The first requirement is to install Elastic search, which i have done multiple times. I did the following steps: https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html

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/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt-get update && sudo apt-get install elasticsearch

I'm using the systemd configuration:

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service

I'm running curl localhost:9200 and everything is working.

Next I try to install elastic app search. https://www.elastic.co/guide/en/app-search/current/installation.html#installation-self-managed. Which doesn't have instructions for debian systems. But it does have a .deb install file. I downloaded the file and put it in my project route.

I ran dpkg -i on the file and it seems to have installed. When I run the command to check the file location it shows this:

 dpkg -L enterprise-search
/.
/etc
/etc/init.d
/etc/init.d/enterprise-search
/var
/var/log
/var/log/enterprise-search
/usr
/usr/share
/usr/share/enterprise-search
/usr/share/enterprise-search/README.md
/usr/share/enterprise-search/bin
/usr/share/enterprise-search/bin/vendor
/usr/share/enterprise-search/bin/vendor/filebeat
/usr/share/enterprise-search/bin/vendor/filebeat/filebeat-linux-x86_64
/usr/share/enterprise-search/bin/enterprise-search
/usr/share/enterprise-search/filebeat
/usr/share/enterprise-search/filebeat/ecs-template.json
/usr/share/enterprise-search/filebeat/filebeat-ecs.yml
/usr/share/enterprise-search/lib
/usr/share/enterprise-search/lib/require_java_version.sh
/usr/share/enterprise-search/lib/enterprise-search.war
/usr/share/enterprise-search/jetty
/usr/share/enterprise-search/jetty/webserver-ssl.xml
/usr/share/enterprise-search/jetty/webserver-ssl-with-redirect.xml
/usr/share/enterprise-search/jetty/webserver.xml
/usr/share/enterprise-search/LICENSE
/usr/share/enterprise-search/config
/usr/share/enterprise-search/config/env.sh
/usr/share/enterprise-search/config/enterprise-search.yml
/usr/share/enterprise-search/NOTICE.txt
/usr/share/doc
/usr/share/doc/enterprise-search
/usr/share/doc/enterprise-search/changelog.gz
/usr/lib
/usr/lib/systemd
/usr/lib/systemd/system
/usr/lib/systemd/system/enterprise-search.service

I'm not really sure if this is the correct location? I want it to live in the same place as my elasticsearch install, but I'm actually not sure. I did all the next steps for the install process and ran: ./usr/share/enterprise-search/bin/elasticsearch

But this gives me the error:

Could not find java in PATH

I'm very confused by this since the main elasticsearch installation works and that also needs java? Also i want it also to run with systemd auto-enable and i want it to be available with enterprise-search start / stop. Not sure how to handle that.

Christophvh
  • 12,586
  • 7
  • 48
  • 70
  • 1
    What do `echo $PATH` and `echo $JAVA_HOME` look like? We need to get java in there, try `which java` and `which javac` to see if they're already around. There's also `update-java-alternatives` if you have the universe packages (can get them with `apt-get install openjdk-11-jdk`). – Lewis Jul 17 '20 at 08:24
  • @Christian re-installing java has worked. Very weird seems like enterprise-search and the main elasticsearch instance need separate java versions? But it works now thanks – Christophvh Aug 07 '20 at 10:00

2 Answers2

1

Looks like it's Debian package, so it's installable on ubuntu, but some things may differ. I would say you can:

  1. Just switch to using debian VM for this (here you can get vagrant for one: https://app.vagrantup.com/debian/boxes/stretch64 )
  2. Debug. From what I see that package runs elasticsearch-env before it runs itself. Java is looked for like this:
 if [ ! -z "$JAVA_HOME" ]; then
   JAVA="$JAVA_HOME/bin/java"
   JAVA_TYPE="JAVA_HOME"
 else
   if [ "$(uname -s)" = "Darwin" ]; then
     # macOS has a different structure
     JAVA="$ES_HOME/jdk.app/Contents/Home/bin/java"
   else
     JAVA="$ES_HOME/jdk/bin/java"
   fi
   JAVA_TYPE="bundled jdk"
 fi

 if [ ! -x "$JAVA" ]; then
     echo "could not find java in $JAVA_TYPE at $JAVA" >&2
     exit 1
   fi

So I would advise to set JAVA_HOME in start script (or before running the binary), and see if that helps.

alfheim
  • 107
  • 5
  • Thanks for your answer. The main problem i have is that I'm searching for a way to have it work like the systemd install of the main elasticsearch install. This install process seems to work different. Switching VM just for this is not an option. I can re-install java, but that would just have 2 instances running and this install just feels wrong. – Christophvh Aug 07 '20 at 08:53
  • Then you can add `export JAVA_HOME=/your/path/to/java` to the `/etc/profile` or you can add that to the systemd file as environment variable. – alfheim Sep 01 '20 at 09:09
0

I solved it by adding another version of Java, Elastichsearch has a java install build-in and not separate, so the app-search install can't reach that version. Feels very dirty but got it working!

Christophvh
  • 12,586
  • 7
  • 48
  • 70