Cannot run elasticesarch in ubuntu

Hello!
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. java.io.FileNotFoundException: /opt/elasticsearch-2.3.2/logs/elasticsearch.log (Permission denied) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.<init>(FileOutputStream.java:221) at java.io.FileOutputStream.<init>(FileOutputStream.java:142) at org.apache.log4j.FileAppender.setFile(FileAppender.java:294) at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165) at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:223) at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:842) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768) at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514) at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:440) at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:128) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:243) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35) log4j:ERROR Either File or DatePattern options are not set for appender [file]. log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: /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(Bootstrap.java:93) at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

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