deb.asciidoc 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. [[deb]]
  2. === Install Elasticsearch with Debian Package
  3. The Debian package for Elasticsearch can be <<install-deb,downloaded from our website>>
  4. or from our <<deb-repo,APT repository>>. It can be used to install
  5. Elasticsearch on any Debian-based system such as Debian and Ubuntu.
  6. include::license.asciidoc[]
  7. The latest stable version of Elasticsearch can be found on the
  8. link:/downloads/elasticsearch[Download Elasticsearch] page. Other versions can
  9. be found on the link:/downloads/past-releases[Past Releases page].
  10. NOTE: Elasticsearch includes a bundled version of https://openjdk.java.net[OpenJDK]
  11. from the JDK maintainers (GPLv2+CE). To use your own version of Java,
  12. see the <<jvm-version, JVM version requirements>>
  13. [[deb-key]]
  14. ==== Import the Elasticsearch PGP Key
  15. include::key.asciidoc[]
  16. [source,sh]
  17. -------------------------
  18. wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
  19. -------------------------
  20. [[deb-repo]]
  21. ==== Installing from the APT repository
  22. ifeval::["{release-state}"=="unreleased"]
  23. WARNING: Version {version} of Elasticsearch has not yet been released.
  24. endif::[]
  25. You may need to install the `apt-transport-https` package on Debian before proceeding:
  26. [source,sh]
  27. --------------------------------------------------
  28. sudo apt-get install apt-transport-https
  29. --------------------------------------------------
  30. Save the repository definition to +/etc/apt/sources.list.d/elastic-{major-version}.list+:
  31. ifeval::["{release-state}"=="released"]
  32. ["source","sh",subs="attributes,callouts"]
  33. --------------------------------------------------
  34. echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/{major-version}/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-{major-version}.list
  35. --------------------------------------------------
  36. ifeval::["{release-state}"=="prerelease"]
  37. ["source","sh",subs="attributes,callouts"]
  38. --------------------------------------------------
  39. echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/{major-version}-prerelease/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-{major-version}.list
  40. --------------------------------------------------
  41. endif::[]
  42. [NOTE]
  43. ==================================================
  44. These instructions do not use `add-apt-repository` for several reasons:
  45. . `add-apt-repository` adds entries to the system `/etc/apt/sources.list` file
  46. rather than a clean per-repository file in `/etc/apt/sources.list.d`
  47. . `add-apt-repository` is not part of the default install on many distributions
  48. and requires a number of non-default dependencies.
  49. . Older versions of `add-apt-repository` always add a `deb-src` entry which
  50. will cause errors because we do not provide a source package. If you have added
  51. the `deb-src` entry, you will see an error like the following until you delete
  52. the `deb-src` line:
  53. Unable to find expected entry 'main/source/Sources' in Release file
  54. (Wrong sources.list entry or malformed file)
  55. ==================================================
  56. You can install the Elasticsearch Debian package with:
  57. [source,sh]
  58. --------------------------------------------------
  59. sudo apt-get update && sudo apt-get install elasticsearch
  60. --------------------------------------------------
  61. [WARNING]
  62. ==================================================
  63. If two entries exist for the same Elasticsearch repository, you will see an error like this during `apt-get update`:
  64. ["literal",subs="attributes,callouts"]
  65. Duplicate sources.list entry https://artifacts.elastic.co/packages/{major-version}/apt/ ...`
  66. 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.
  67. ==================================================
  68. endif::[]
  69. include::skip-set-kernel-parameters.asciidoc[]
  70. [[install-deb]]
  71. ==== Download and install the Debian package manually
  72. ifeval::["{release-state}"=="unreleased"]
  73. WARNING: Version {version} of Elasticsearch has not yet been released.
  74. endif::[]
  75. The Debian package for Elasticsearch v{version} can be downloaded from the website and installed as follows:
  76. ["source","sh",subs="attributes"]
  77. --------------------------------------------
  78. wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-amd64.deb
  79. wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-amd64.deb.sha512
  80. shasum -a 512 -c elasticsearch-{version}-amd64.deb.sha512 <1>
  81. sudo dpkg -i elasticsearch-{version}-amd64.deb
  82. --------------------------------------------
  83. <1> Compares the SHA of the downloaded Debian package and the published checksum, which should output
  84. `elasticsearch-{version}-amd64.deb: OK`.
  85. // Set a `distro` attribute so we can reuse files containing anchors
  86. :distro: deb
  87. [id="deb-security-configuration"]
  88. include::package-security.asciidoc[]
  89. ifdef::include-xpack[]
  90. [role="xpack"]
  91. [[deb-enable-indices]]
  92. ==== Enable automatic creation of system indices
  93. include::xpack-indices.asciidoc[]
  94. endif::include-xpack[]
  95. [id="{distro}-running-systemd"]
  96. include::systemd.asciidoc[]
  97. [[deb-check-running]]
  98. :es-conf: /etc/elasticsearch
  99. :slash: /
  100. include::check-running.asciidoc[]
  101. [[deb-configuring]]
  102. ==== Configuring Elasticsearch
  103. include::etc-elasticsearch.asciidoc[]
  104. The Debian package also has a system configuration file (`/etc/default/elasticsearch`),
  105. which allows you to set the following parameters:
  106. include::sysconfig-file.asciidoc[]
  107. NOTE: Distributions that use `systemd` require that system resource limits be
  108. configured via `systemd` rather than via the `/etc/sysconfig/elasticsearch`
  109. file. See <<systemd>> for more information.
  110. include::connect-clients.asciidoc[]
  111. [[deb-layout]]
  112. ==== Directory layout of Debian package
  113. The Debian package places config files, logs, and the data directory in the appropriate
  114. locations for a Debian-based system:
  115. [cols="<h,<,<m,<m",options="header",]
  116. |=======================================================================
  117. | Type | Description | Default Location | Setting
  118. | home
  119. | Elasticsearch home directory or `$ES_HOME`
  120. | /usr/share/elasticsearch
  121. d|
  122. | bin
  123. | Binary scripts including `elasticsearch` to start a node
  124. and `elasticsearch-plugin` to install plugins
  125. | /usr/share/elasticsearch/bin
  126. d|
  127. | conf
  128. | Configuration files including `elasticsearch.yml`
  129. | /etc/elasticsearch
  130. | <<config-files-location,ES_PATH_CONF>>
  131. | conf
  132. | Environment variables including heap size, file descriptors.
  133. | /etc/default/elasticsearch
  134. d|
  135. | conf
  136. | Generated TLS keys and certificates for the transport and http layer.
  137. | /etc/elasticsearch/certs
  138. d|
  139. | data
  140. | The location of the data files of each index / shard allocated
  141. on the node.
  142. | /var/lib/elasticsearch
  143. | path.data
  144. | jdk
  145. | The bundled Java Development Kit used to run Elasticsearch. Can
  146. be overridden by setting the `ES_JAVA_HOME` environment variable
  147. in `/etc/default/elasticsearch`.
  148. | /usr/share/elasticsearch/jdk
  149. d|
  150. | logs
  151. | Log files location.
  152. | /var/log/elasticsearch
  153. | path.logs
  154. | plugins
  155. | Plugin files location. Each plugin will be contained in a subdirectory.
  156. | /usr/share/elasticsearch/plugins
  157. |
  158. | repo
  159. | 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.
  160. d| Not configured
  161. | path.repo
  162. |=======================================================================
  163. include::security-files-reference.asciidoc[]
  164. include::next-steps.asciidoc[]