# I downloaded and installed elasticsearch

**URL:** <https://discuss.elastic.co/t/i-downloaded-and-installed-elasticsearch/266623>\
**Category:** Elasticsearch\
**Created:** [March 9, 2021, 12:45am UTC](https://discuss.elastic.co/t/i-downloaded-and-installed-elasticsearch/266623 "2021-03-09T00:45:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaulGureghian](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@PaulGureghian](https://discuss.elastic.co/u/PaulGureghian)\
**Post date:** [March 9, 2021, 12:45am UTC](https://discuss.elastic.co/t/i-downloaded-and-installed-elasticsearch/266623/1 "2021-03-09T00:45:16Z")

</div>

\*\*On Linux Mint. I extracted the archive tar.gz and cd into elasticsearch dir and ran ./bin/elasticsearch, \*\*

**The error message was: could not find java in the bundled jdk dir.**

**I have Open JDK already installed on my system.**

---

<div class="post-metadata">

**Author:** ![emahdij](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emahdij/32/73570_2.png) [@emahdij](https://discuss.elastic.co/u/emahdij)\
**Post date:** [March 9, 2021, 5:17am UTC](https://discuss.elastic.co/t/i-downloaded-and-installed-elasticsearch/266623/2 "2021-03-09T05:17:55Z")

</div>

Hi Paul  
If you have already installed java. you have to set JAVA\_HOME variable.  
You can use below command to do that

```auto
export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which java)))))
export PATH=$PATH:$JAVA_HOME/bin

```

To confirm that you've done it correctly run this command:

```auto
echo $JAVA_HOME

```

The output off command should be something like:

```auto
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre

```

---

<div class="post-metadata">

**Author:** ![PaulGureghian](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@PaulGureghian](https://discuss.elastic.co/u/PaulGureghian)\
**Post date:** [March 9, 2021, 7:01pm UTC](https://discuss.elastic.co/t/i-downloaded-and-installed-elasticsearch/266623/3 "2021-03-09T19:01:31Z")

</div>

Which file should I edit ? there are multiple files that have been recommended.

---

<div class="post-metadata">

**Author:** ![emahdij](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emahdij/32/73570_2.png) [@emahdij](https://discuss.elastic.co/u/emahdij)\
**Post date:** [March 9, 2021, 7:53pm UTC](https://discuss.elastic.co/t/i-downloaded-and-installed-elasticsearch/266623/4 "2021-03-09T19:53:44Z")

</div>

First of all test these commands and run elasticsearch again:

```auto
export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which java)))))
export PATH=$PATH:$JAVA_HOME/bin

```

If everything's ok you can create the file and add commands to that in this directory:

```auto
 /etc/profile.d/java.sh

```

and finally, make source that:

```auto
source /etc/profile.d/java.sh

```

---

<div class="post-metadata">

**Author:** ![PaulGureghian](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@PaulGureghian](https://discuss.elastic.co/u/PaulGureghian)\
**Post date:** [March 9, 2021, 10:21pm UTC](https://discuss.elastic.co/t/i-downloaded-and-installed-elasticsearch/266623/5 "2021-03-09T22:21:54Z")

</div>

Even if I have Java on the PATH variable, do I have to do it again ?

---

<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:** [April 6, 2021, 10:22pm UTC](https://discuss.elastic.co/t/i-downloaded-and-installed-elasticsearch/266623/6 "2021-04-06T22:22:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
