Mint Linux Service (running Elasticsearch as a service on Mint Linux)

Could someone help me get Elasticsearch set up as a service on Mint Linux?

Running Elasticsearch on Windows is no problem, running Elasticsearch manually
on Mint is no problem. But I need help combining two tidbits of
knowledge:

  1. Configuring something to run as a service on Mint.
  2. Anything specific to running Elasticsearch as a service on Linux

I downloaded the Elasticsearch tar.gz and easily uncompressed it and
configured it to run. So Elasticsearch runs on Mint no problem.

Next I set up the repository and pulled the Elasticsearch Debian package and
installed it (sudo apt-get install elasticsearch), I edited the configuration file for basic setup like normal. Then I used [Preferences]"Startup Applications" and created what I assume is a "service" executing "/usr/share/elasticsearch/bin/elasticsearch - however it doesn't appear to run (and I lack Linux skills to debug the problem).

I'm a bit confused on how "Startup Applications" works as there is no facility to specify which user the program is running as. I can't find anything related to elastic in syslog. Elasticsearch itself is not generating any (new) log so that is consistent with it not actually running.

Mint 17.3 Cinnamon
Elasticsearch 2.2.0

"Startup Applications" are applications started after the UI is loaded to start GUI applications. It's better to use "low level" standard linux tools to start services like ElasticSearch. There are 3 of them at the moment: the old sysvinit, upstart and systemd.

I've never used Linux Mint, but apparently it's using Upstart (and sysvinit, but don't use it). You can easily find docs and tutorials about upstart. This is my upstart conf (in /etc/init/elasticsearch.conf):

exec /elasticsearch/bin/elasticsearch
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]
limit nofile 524288 1048576
limit nproc 524288 1048576
respawn

Change the path to the ES bin.

Regards.

Thanks vad.

The current Elastic documentation says: "Users running Debian 8 or Ubuntu 14 or later may require configuration of systemd instead of update-rc.d. In those cases, please refer to the the section called “Using systemdedit” section."

That calls for running: "sudo /bin/systemctl enable elasticsearch.service" which on Mint responds with "sudo: /bin/systemctl: command not found.

I'll try to research "upstart" that's all "Greek" to me at the moment.

Well, you can just create that file and then start it with

service elasticsearch start

When you reboot, it will start automatically.

Thanks again vad.

I also found some excellent documentation for accomplishing this: