# Cannot run elasticesarch in ubuntu

**URL:** <https://discuss.elastic.co/t/cannot-run-elasticesarch-in-ubuntu/50313>\
**Category:** Elasticsearch\
**Created:** [May 18, 2016, 8:20am UTC](https://discuss.elastic.co/t/cannot-run-elasticesarch-in-ubuntu/50313 "2016-05-18T08:20:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hobbit](https://avatars.discourse-cdn.com/v4/letter/h/67e7ee/32.png) [@Hobbit](https://discuss.elastic.co/u/Hobbit)\
**Post date:** [May 18, 2016, 8:20am UTC](https://discuss.elastic.co/t/cannot-run-elasticesarch-in-ubuntu/50313/1 "2016-05-18T08:20:08Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 18, 2016, 8:22am UTC](https://discuss.elastic.co/t/cannot-run-elasticesarch-in-ubuntu/50313/2 "2016-05-18T08:22:42Z")

</div>

> [@Hobbit](#):
>
> don't run elasticsearch as root

Like it says, never do this.

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

---

<div class="post-metadata">

**Author:** ![Hobbit](https://avatars.discourse-cdn.com/v4/letter/h/67e7ee/32.png) [@Hobbit](https://discuss.elastic.co/u/Hobbit)\
**Post date:** [May 18, 2016, 8:24am UTC](https://discuss.elastic.co/t/cannot-run-elasticesarch-in-ubuntu/50313/3 "2016-05-18T08:24:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 18, 2016, 8:25am UTC](https://discuss.elastic.co/t/cannot-run-elasticesarch-in-ubuntu/50313/4 "2016-05-18T08:25:43Z")

</div>

Your permissions are incorrect.

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

---

<div class="post-metadata">

**Author:** ![Hobbit](https://avatars.discourse-cdn.com/v4/letter/h/67e7ee/32.png) [@Hobbit](https://discuss.elastic.co/u/Hobbit)\
**Post date:** [May 18, 2016, 8:26am UTC](https://discuss.elastic.co/t/cannot-run-elasticesarch-in-ubuntu/50313/5 "2016-05-18T08:26:19Z")

</div>

okay I'll try it.Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:50pm UTC](https://discuss.elastic.co/t/cannot-run-elasticesarch-in-ubuntu/50313/6 "2017-07-05T22:50:48Z")

</div>


