Unable to install Search Guard Bundle for ES 5.3

Unable to install Search Guard Bundle 5.3.0-12 for ES 5.3 on RHEL 6.6 having JDK as jdk1.8.0_73

As mentioned in Search Bundle Installation Page, unable to run ./elasticsearch--localhost/bin/elasticsearch

Case 1

Steps performed as root user :

  1. Downloaed elasticsearch-5.3.0-12-62A9D172-9440-47FF-ABE3-59B73F7C40B5.tar.gz file from here

  2. extracted tar file.

  3. executed ./elasticsearch-5.3.0-localhost/bin/elasticsearch

Output:

[WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [localhost] uncaught exception in thread [main]

org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:58) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.3.0.jar:5.3.0]

Caused by: java.lang.RuntimeException: can not run elasticsearch as root

at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:204) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:360) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.3.0.jar:5.3.0]

… 6 more

Case 2

Steps performed as 502 user:

  1. Downloaed elasticsearch-5.3.0-12-62A9D172-9440-47FF-ABE3-59B73F7C40B5.tar.gz file

  2. extracted tar file.

  3. created user (502) and group(games) and provided permissions

  4. su 502

  5. executed ./elasticsearch-5.3.0-localhost/bin/elasticsearch

Output:

Error: Could not find or load main class org.elasticsearch.tools.JavaVersionChecker

Elasticsearch requires at least Java 8 but your Java version from /usr/java/jdk1.8.0_73/jre//bin/java does not meet this requirement

  1. executed sudo ./elasticsearch-5.3.0-localhost/bin/elasticsearch

Output:

[WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [localhost] uncaught exception in thread [main]

org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:58) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.3.0.jar:5.3.0]

Caused by: java.lang.RuntimeException: can not run elasticsearch as root

at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:204) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:360) ~[elasticsearch-5.3.0.jar:5.3.0]

at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.3.0.jar:5.3.0]

… 6 more