'Why is Elasticsearch 8x. starting interactively but not as a service Ubuntu 20.04?

The tip for fixing this issue on Ubuntu 16.04 does not seem to work. Here's a link to one of the areas of various tips: https://discuss.elastic.co/t/cant-start-elasticsearch-with-ubuntu-16-04/48730/28

There's something missing - I'm on ubuntu 20.04, and ES v8.x, logstash 8.x, kibana 8.x. Manually starting works great. Notes:

  1. There was NO "etc/default/elasticsearch" file at all; I created one: (and yes, the user & group do exist; and all ownership has been changed on all the files)

    #Here's the "/etc/default/elasticsearch" file I created: ES_USER="elasticsearch" ES_GROUP="elasticsearch"

    START_DAEMON="true" <-- Is this even needed beyone Ubuntu 16? RESTART_ON_UPGRADE="true"

  2. I think I installed via the deb .tar packages and not via APT

  3. It runs GREAT; but only "interactively" - so how do we fix the fact that no service exists? I've tried all the related tips, and all other recommendations. - ??

    elasticsearch@ES-VM:/etc/default$ service elasticsearch status Unit elasticsearch.service could not be found.

    root@ES-VM:/etc/default# service elasticsearch start Failed to start elasticsearch.service: Unit elasticsearch.service not found.

Any help would be greatly appreciated. Thanks in advance!



Solution 1:[1]

if you installed via the tar file then there's nothing else that is created on the system, no defaults file, no service file. that's a pretty typical linux approach to "installing" anything via a tgz, as it's akin to an "unzip"

if you want to start this as a service then use the deb package or the apt repo, or you will need to create your own service file

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mark Walkom