Cannot run elasticesarch in ubuntu

I followed the installation steps and when I try to run ./elasticsearch in my /bin/ path,this error came out:
log4j:ERROR setFile(null,true) call failed. /opt/elasticsearch-2.3.2/logs/elasticsearch.log (Permission denied) at Method) at<init>( at<init>( at org.apache.log4j.FileAppender.setFile( at org.apache.log4j.FileAppender.activateOptions( at org.apache.log4j.DailyRollingFileAppender.activateOptions( at org.apache.log4j.config.PropertySetter.activate( at org.apache.log4j.config.PropertySetter.setProperties( at org.apache.log4j.config.PropertySetter.setProperties( at org.apache.log4j.PropertyConfigurator.parseAppender( at org.apache.log4j.PropertyConfigurator.parseCategory( at org.apache.log4j.PropertyConfigurator.configureRootCategory( at org.apache.log4j.PropertyConfigurator.doConfigure( at org.apache.log4j.PropertyConfigurator.configure( at org.elasticsearch.common.logging.log4j.LogConfigurator.configure( at org.elasticsearch.bootstrap.Bootstrap.init( at org.elasticsearch.bootstrap.Elasticsearch.main( log4j:ERROR Either File or DatePattern options are not set for appender [file]. log4j:ERROR setFile(null,true) call failed. /opt/elasticsearch-2.3.2/logs/elasticsearch_deprecation.log (Permission denied)

so I changed the user&user group of the elasticsearch.log to the same one with the elasticsearch file and make sure the elasticsearch.log file is access to the user,it still shows the same error.

Afterwards I change all the directory user to root,and I run the elasticsearch file as root,but another error came out ..

Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root. at org.elasticsearch.bootstrap.Bootstrap.initializeNatives( at org.elasticsearch.bootstrap.Bootstrap.setup( at org.elasticsearch.bootstrap.Bootstrap.init( at org.elasticsearch.bootstrap.Elasticsearch.main(

Anyone have any ideas?
Thanks a lot!

Like it says, never do this.

Given you are running on Ubuntu, why not install via the apt repo?

1 Like

but..I try to run it as normal user,it shows the forward error

1 Like

Your permissions are incorrect.

Again, use the repos, it'll manage everything for you.

1 Like

okay I'll try it.Thanks!

1 Like