Error Can’t Run Elasticsearch As a Root User In Linux

When you’re installing Elasticsearch by the root user. It won’t allow you to install it. This will give you an Error Can’t Run Elasticsearch as root. Sometimes Elasticsearch service failed as you need to set some parameters in Elasticsearch config and you can check Elasticsearch status, red and node health.

Check Out: How To Install Winscp Open-source Software In Ubuntu 18.04

Elasticsearch is a process. So this needs a user to run and installed.

Error Can’t Run Elasticsearch As Root In Linux:

So, you can follow official Documentation, You may follow here Elasticsearch

elasticsearch cluster state

Check Out: Install Elasticsearch Using Source Code

Follow these steps to solve your issues

Solution 1: Set JAVA_HOME path so

export JAVA_HOME=/usr/java/jdk-12/bin/java

Check Out: Step To Install Erlang Package

Solution 2: You can’t run Elasticsearch by the root user. So, you need to have a user and group and make this user to the owner of Elasticsearch directory

useradd elastic
groupadd elastic
chown -R elastic:elastic elasticsearch-6.5.0

Check Out: BootStrap Checks Failed In ElasticSearch

then try this from bin folder so

./elasticsearch -d

Solution 3: Run this command to allow the root user to install Elasticsearch

bin/elasticsearch -Des.insecure.allow.root=true -d

Else so

Check Out: Configuration Settings of Elasticsearch Before Installing

add these line to allow root in vim bin/elasticsearch


You’re done elasticsearch service check elasticsearch status elasticsearch status red elasticsearch node health

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment