Evol Rof
Evol Rof

Reputation: 2802

elasticsearch can't start with an non-root user

I am using elasticsearch as a search engine for my website.After I downloaded the elasticsearch I use the command ./bin/elasticsearch I got an error

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

I google it and run the command

groupadd esgroup        
useradd esuser -g esgroup -p espassword
chown -R esuser:esgroup elasticsearch

and I switch to esuser but I cant cd /root

bash: cd: /root: Permission denied

so I have to switch to root user and stay at /root/elasticsearch/ and change to esuser then I run the command

./bin/elasticsearch

this time I get a different error

Error: Could not find or load main classorg.elasticsearch.bootstrap.Elasticsearch

I already install java-1.8.0-openjdk-devel and the java -version javac command works I am using centos6 x64 Is there something I miss?

Upvotes: 1

Views: 2247

Answers (1)

alr
alr

Reputation: 1804

please download & install the whole elasticsearch zip as a non-root user instead of trying to fiddle with permissions inside of the /root/ directory (where also data & logs are written to).

if you dont want to deal with such things, the easiest way might be to use one of the existing packages.

Upvotes: 1

Related Questions