[[targz]]
=== Install {es} from archive on Linux or MacOS

:include-xpack: true

{es} is available as a `.tar.gz` archive for Linux and MacOS.

include::license.asciidoc[]

The latest stable version of {es} can be found on the
link:/downloads/elasticsearch[Download {es}] page.
Other versions can be found on the
link:/downloads/past-releases[Past Releases page].

NOTE: {es} includes a bundled version of https://openjdk.java.net[OpenJDK]
from the JDK maintainers (GPLv2+CE). To use your own version of Java,
see the <<jvm-version, JVM version requirements>>

[[install-linux]]
==== Download and install archive for Linux

ifeval::["{release-state}"=="unreleased"]

WARNING: Version {version} of {es} has not yet been released.

endif::[]

The Linux archive for {es} v{version} can be downloaded and installed as follows:

["source","sh",subs="attributes"]
--------------------------------------------
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-linux-x86_64.tar.gz.sha512
shasum -a 512 -c elasticsearch-{version}-linux-x86_64.tar.gz.sha512 <1>
tar -xzf elasticsearch-{version}-linux-x86_64.tar.gz
cd elasticsearch-{version}/ <2>
--------------------------------------------
<1> Compares the SHA of the downloaded `.tar.gz` archive and the published checksum, which should output
    `elasticsearch-{version}-linux-x86_64.tar.gz: OK`.
<2> This directory is known as `$ES_HOME`.

[[install-macos]]
==== Download and install archive for MacOS

ifeval::["{release-state}"=="unreleased"]

WARNING: Version {version} of {es} has not yet been released.

endif::[]

[IMPORTANT]
.macOS Gatekeeper warnings
====
Apple's rollout of stricter notarization requirements affected the notarization of the {version} {es} artifacts. If macOS displays a dialog when you first run {es} that interrupts it, then you need to take an action to allow it to run.

To prevent Gatekeeper checks on the {es} files, run the following command on the downloaded .tar.gz archive or the directory to which was extracted:

[source,sh]
----
xattr -d -r com.apple.quarantine <archive-or-directory>
----

Alternatively, you can add a security override by following the instructions in the _If you want to open an app that hasn't been notarized or is from an unidentified developer_ section of https://support.apple.com/en-us/HT202491[Safely open apps on your Mac].
====

The MacOS archive for {es} v{version} can be downloaded and installed as follows:

["source","sh",subs="attributes"]
--------------------------------------------
curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-darwin-x86_64.tar.gz
curl https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-darwin-x86_64.tar.gz.sha512 | shasum -a 512 -c - <1>
tar -xzf elasticsearch-{version}-darwin-x86_64.tar.gz
cd elasticsearch-{version}/ <2>
--------------------------------------------
// NOTCONSOLE

<1> Compares the SHA of the downloaded `.tar.gz` archive and the published checksum, which should output
    `elasticsearch-{version}-darwin-x86_64.tar.gz: OK`.
<2> This directory is known as `$ES_HOME`.

ifdef::include-xpack[]
[role="xpack"]
[[targz-enable-indices]]
==== Enable automatic creation of system indices

include::xpack-indices.asciidoc[]

endif::include-xpack[]

[[targz-running]]
include::targz-start.asciidoc[]

:es-conf:      $ES_HOME/config
:slash:        /

include::check-running.asciidoc[]

Log printing to `stdout` can be disabled using the `-q` or `--quiet`
option on the command line.

[[setup-installation-daemon]]
include::targz-daemon.asciidoc[]

[[targz-configuring]]
==== Configure {es} on the command line

{es} loads its configuration from the `$ES_HOME/config/elasticsearch.yml`
file by default. The format of this config file is explained in
<<settings>>.

Any settings that can be specified in the config file can also be specified on
the command line, using the `-E` syntax as follows:

[source,sh]
--------------------------------------------
./bin/elasticsearch -d -Ecluster.name=my_cluster -Enode.name=node_1
--------------------------------------------

TIP: Typically, any cluster-wide settings (like `cluster.name`) should be
added to the `elasticsearch.yml` config file, while any node-specific settings
such as `node.name` could be specified on the command line.

include::connect-clients.asciidoc[]

[[targz-layout]]
==== Directory layout of archives

The archive distributions are entirely self-contained. All files and
directories are, by default, contained within `$ES_HOME` -- the directory
created when unpacking the archive.

This is very convenient because you don't have to create any directories to
start using {es}, and uninstalling {es} is as easy as
removing the `$ES_HOME` directory. However, it is advisable to change the
default locations of the config directory, the data directory, and the logs
directory so that you do not delete important data later on.


[cols="<h,<,<m,<m",options="header",]
|=======================================================================
| Type | Description | Default Location | Setting
| home
  | {es} home directory or `$ES_HOME`
 d| Directory created by unpacking the archive
  |

| bin
  | Binary scripts including `elasticsearch` to start a node
    and `elasticsearch-plugin` to install plugins
  | $ES_HOME/bin
 d|

| conf
  | Configuration files including `elasticsearch.yml`
  | $ES_HOME/config
  | <<config-files-location,ES_PATH_CONF>>

| conf
  | Generated TLS keys and certificates for the transport and HTTP layer.
  | $ES_HOME/config/certs
 d|

| data
  | The location of the data files of each index / shard allocated
    on the node.
  | $ES_HOME/data
  | path.data

| logs
  | Log files location.
  | $ES_HOME/logs
  | path.logs

| plugins
  | Plugin files location. Each plugin will be contained in a subdirectory.
  | $ES_HOME/plugins
  |

| repo
  | Shared file system repository locations. Can hold multiple locations. A file system repository can be placed in to any subdirectory of any directory specified here.
 d| Not configured
  | path.repo

|=======================================================================

include::security-files-reference.asciidoc[]
include::next-steps.asciidoc[]
