I am trying to install elasticsearch 5.2.2 in CentOS. What's unique is that I want to use the jre which is distributed with our product. We create a user say user1 and install our product. The jre is in directory say /XYZ/jre64. Now I want to install elasticsearch and make it use our jre to run.
I was able to run it with the following changes:
- Installed ES using the rpm distribution and installed it.
- Upon installation it creates a default user and group called elasticsearch
- I went to the /etc/init.d/elasticsearch script and changed the user to user1. I did this because elasticsearch user didn't have permission to the /XYZ/jre64 folder which was created by user1 and I didn't want to change the permission of it.
- Then I had to give read write permissions to the log ,config ,path folders of the elasticsearch.
- Ran the service and it worked.
I am overall not satisfied with the way I changed the user and then had to change the permissions of the elasticsearch specific directories.
Is there a better approach to do this? Can we specify custom user while installing the elasticsearch and not after installing and changing the permissions?
Is there a better approach to this type of installation?