2016-04-03 10:09:24 -04:00
[[deb]]
=== Install Elasticsearch with Debian Package
2017-03-06 17:37:48 -05:00
The Debian package for Elasticsearch can be <<install-deb,downloaded from our website>>
2018-05-01 20:04:16 -04:00
or from our <<deb-repo,APT repository>>. It can be used to install
2016-04-03 10:09:24 -04:00
Elasticsearch on any Debian-based system such as Debian and Ubuntu.
2018-05-01 20:04:16 -04:00
include::license.asciidoc[]
2016-04-03 10:09:24 -04:00
The latest stable version of Elasticsearch can be found on the
link:/downloads/elasticsearch[Download Elasticsearch] page. Other versions can
be found on the link:/downloads/past-releases[Past Releases page].
2016-11-09 05:54:56 -05:00
NOTE: Elasticsearch requires Java 8 or later. Use the
2016-11-01 17:52:09 -04:00
http://www.oracle.com/technetwork/java/javase/downloads/index.html[official Oracle distribution]
or an open-source distribution such as http://openjdk.java.net[OpenJDK].
2016-04-03 10:09:24 -04:00
[[deb-key]]
==== Import the Elasticsearch PGP Key
include::key.asciidoc[]
[source,sh]
-------------------------
2016-09-19 21:10:45 -04:00
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
2016-04-03 10:09:24 -04:00
-------------------------
[[deb-repo]]
==== Installing from the APT repository
2016-10-06 11:56:55 -04:00
ifeval::["{release-state}"=="unreleased"]
Version {version} of Elasticsearch has not yet been released.
endif::[]
ifeval::["{release-state}"!="unreleased"]
2016-04-03 10:09:24 -04:00
You may need to install the `apt-transport-https` package on Debian before proceeding:
[source,sh]
--------------------------------------------------
sudo apt-get install apt-transport-https
--------------------------------------------------
2016-09-19 21:10:45 -04:00
Save the repository definition to +/etc/apt/sources.list.d/elastic-{major-version}.list+:
2016-04-03 10:09:24 -04:00
2016-10-06 11:56:55 -04:00
ifeval::["{release-state}"=="released"]
2016-04-03 10:09:24 -04:00
["source","sh",subs="attributes,callouts"]
--------------------------------------------------
2017-05-09 12:33:13 -04:00
echo "deb https://artifacts.elastic.co/packages/{major-version}/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-{major-version}.list
2016-04-03 10:09:24 -04:00
--------------------------------------------------
2016-10-06 11:56:55 -04:00
endif::[]
ifeval::["{release-state}"=="prerelease"]
["source","sh",subs="attributes,callouts"]
--------------------------------------------------
2017-05-09 12:33:13 -04:00
echo "deb https://artifacts.elastic.co/packages/{major-version}-prerelease/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-{major-version}.list
2016-10-06 11:56:55 -04:00
--------------------------------------------------
endif::[]
2017-01-10 13:49:57 -05:00
[NOTE]
2016-04-03 10:09:24 -04:00
==================================================
2017-01-10 13:49:57 -05:00
These instructions do not use `add-apt-repository` for several reasons:
. `add-apt-repository` adds entries to the system `/etc/apt/sources.list` file
rather than a clean per-repository file in `/etc/apt/sources.list.d`
. `add-apt-repository` is not part of the default install on many distributions
and requires a number of non-default dependencies.
. Older versions of `add-apt-repository` always add a `deb-src` entry which
will cause errors because we do not provide a source package. If you have added
the `deb-src` entry, you will see an error like the following until you delete
the `deb-src` line:
2016-04-03 10:09:24 -04:00
Unable to find expected entry 'main/source/Sources' in Release file
(Wrong sources.list entry or malformed file)
==================================================
You can install the Elasticsearch Debian package with:
[source,sh]
--------------------------------------------------
sudo apt-get update && sudo apt-get install elasticsearch
--------------------------------------------------
[WARNING]
==================================================
If two entries exist for the same Elasticsearch repository, you will see an error like this during `apt-get update`:
["literal",subs="attributes,callouts"]
2016-09-20 02:11:02 -04:00
Duplicate sources.list entry https://artifacts.elastic.co/packages/{major-version}/apt/ ...`
2016-04-03 10:09:24 -04:00
Examine +/etc/apt/sources.list.d/elasticsearch-{major-version}.list+ for the duplicate entry or locate the duplicate entry amongst the files in `/etc/apt/sources.list.d/` and the `/etc/apt/sources.list` file.
==================================================
2016-10-06 15:40:17 -04:00
endif::[]
2016-12-01 17:23:51 -05:00
include::skip-set-kernel-parameters.asciidoc[]
2016-04-03 10:09:24 -04:00
[[install-deb]]
==== Download and install the Debian package manually
2016-10-06 15:40:17 -04:00
ifeval::["{release-state}"=="unreleased"]
Version {version} of Elasticsearch has not yet been released.
endif::[]
ifeval::["{release-state}"!="unreleased"]
2017-03-20 10:07:59 -04:00
The Debian package for Elasticsearch v{version} can be downloaded from the website and installed as follows:
2016-04-03 10:09:24 -04:00
["source","sh",subs="attributes"]
--------------------------------------------
2016-09-19 21:10:45 -04:00
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.deb
2017-11-29 21:29:06 -05:00
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.deb.sha512
shasum -a 512 -c elasticsearch-{version}.deb.sha512 <1>
2016-04-03 10:09:24 -04:00
sudo dpkg -i elasticsearch-{version}.deb
--------------------------------------------
2017-11-29 21:29:06 -05:00
<1> Compares the SHA of the downloaded Debian package and the published checksum, which should output
`elasticsearch-{version}.deb: OK`.
2018-05-01 20:04:16 -04:00
Alternatively, you can download the following package, which contains only
features that are available under the Apache 2.0 license:
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-{version}.deb
2016-04-03 10:09:24 -04:00
2016-10-06 11:56:55 -04:00
endif::[]
2018-04-09 11:19:38 -04:00
ifdef::include-xpack[]
[[deb-enable-indices]]
==== Enable automatic creation of {xpack} indices
{xpack} will try to automatically create a number of indices within Elasticsearch.
include::{xes-repo-dir}/setup/xpack-indices.asciidoc[]
endif::include-xpack[]
2016-04-03 10:09:24 -04:00
include::init-systemd.asciidoc[]
[[deb-running-init]]
==== Running Elasticsearch with SysV `init`
Use the `update-rc.d` command to configure Elasticsearch to start automatically
when the system boots up:
[source,sh]
--------------------------------------------------
sudo update-rc.d elasticsearch defaults 95 10
--------------------------------------------------
Elasticsearch can be started and stopped using the `service` command:
[source,sh]
--------------------------------------------
sudo -i service elasticsearch start
sudo -i service elasticsearch stop
--------------------------------------------
If Elasticsearch fails to start for any reason, it will print the reason for
failure to STDOUT. Log files can be found in `/var/log/elasticsearch/`.
[[deb-running-systemd]]
include::systemd.asciidoc[]
[[deb-check-running]]
include::check-running.asciidoc[]
[[deb-configuring]]
==== Configuring Elasticsearch
2017-09-27 09:22:52 -04:00
include::etc-elasticsearch.asciidoc[]
2016-04-03 10:09:24 -04:00
The Debian package also has a system configuration file (`/etc/default/elasticsearch`),
which allows you to set the following parameters:
include::sysconfig-file.asciidoc[]
NOTE: Distributions that use `systemd` require that system resource limits be
configured via `systemd` rather than via the `/etc/sysconfig/elasticsearch`
file. See <<systemd>> for more information.
[[deb-layout]]
==== Directory layout of Debian package
The Debian package places config files, logs, and the data directory in the appropriate
locations for a Debian-based system:
[cols="<h,<,<m,<m",options="header",]
|=======================================================================
| Type | Description | Default Location | Setting
| home
| Elasticsearch home directory or `$ES_HOME`
| /usr/share/elasticsearch
d|
| bin
| Binary scripts including `elasticsearch` to start a node
and `elasticsearch-plugin` to install plugins
| /usr/share/elasticsearch/bin
d|
| conf
| Configuration files including `elasticsearch.yml`
| /etc/elasticsearch
2017-08-14 17:19:06 -04:00
| <<config-files-location,ES_PATH_CONF>>
2016-04-03 10:09:24 -04:00
| conf
| Environment variables including heap size, file descriptors.
| /etc/default/elasticsearch
d|
| data
| The location of the data files of each index / shard allocated
on the node. Can hold multiple locations.
| /var/lib/elasticsearch
| path.data
| logs
| Log files location.
2016-05-12 16:42:27 -04:00
| /var/log/elasticsearch
2016-04-03 10:09:24 -04:00
| path.logs
| plugins
| Plugin files location. Each plugin will be contained in a subdirectory.
| /usr/share/elasticsearch/plugins
2016-11-09 05:54:56 -05:00
|
2016-04-03 10:09:24 -04:00
| 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
|=======================================================================
2016-05-06 10:05:19 -04:00
include::next-steps.asciidoc[]