deb.asciidoc 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. The latest stable version of Elasticsearch can be found on the
  7. link:/downloads/elasticsearch[Download Elasticsearch] page. Other versions can
  8. be found on the link:/downloads/past-releases[Past Releases page].
  9. NOTE: Elasticsearch requires Java 8 or later. Use the
  10. http://www.oracle.com/technetwork/java/javase/downloads/index.html[official Oracle distribution]
  11. or an open-source distribution such as http://openjdk.java.net[OpenJDK].
  12. [[deb-key]]
  13. ==== Import the Elasticsearch PGP Key
  14. include::key.asciidoc[]
  15. [source,sh]
  16. -------------------------
  17. wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
  18. -------------------------
  19. [[deb-repo]]
  20. ==== Installing from the APT repository
  21. ifeval::["{release-state}"=="unreleased"]
  22. Version {version} of Elasticsearch has not yet been released.
  23. endif::[]
  24. ifeval::["{release-state}"!="unreleased"]
  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 https://artifacts.elastic.co/packages/{major-version}/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-{major-version}.list
  35. --------------------------------------------------
  36. endif::[]
  37. ifeval::["{release-state}"=="prerelease"]
  38. ["source","sh",subs="attributes,callouts"]
  39. --------------------------------------------------
  40. 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
  41. --------------------------------------------------
  42. endif::[]
  43. [NOTE]
  44. ==================================================
  45. These instructions do not use `add-apt-repository` for several reasons:
  46. . `add-apt-repository` adds entries to the system `/etc/apt/sources.list` file
  47. rather than a clean per-repository file in `/etc/apt/sources.list.d`
  48. . `add-apt-repository` is not part of the default install on many distributions
  49. and requires a number of non-default dependencies.
  50. . Older versions of `add-apt-repository` always add a `deb-src` entry which
  51. will cause errors because we do not provide a source package. If you have added
  52. the `deb-src` entry, you will see an error like the following until you delete
  53. the `deb-src` line:
  54. Unable to find expected entry 'main/source/Sources' in Release file
  55. (Wrong sources.list entry or malformed file)
  56. ==================================================
  57. You can install the Elasticsearch Debian package with:
  58. [source,sh]
  59. --------------------------------------------------
  60. sudo apt-get update && sudo apt-get install elasticsearch
  61. --------------------------------------------------
  62. [WARNING]
  63. ==================================================
  64. If two entries exist for the same Elasticsearch repository, you will see an error like this during `apt-get update`:
  65. ["literal",subs="attributes,callouts"]
  66. Duplicate sources.list entry https://artifacts.elastic.co/packages/{major-version}/apt/ ...`
  67. 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.
  68. ==================================================
  69. endif::[]
  70. include::skip-set-kernel-parameters.asciidoc[]
  71. [[install-deb]]
  72. ==== Download and install the Debian package manually
  73. ifeval::["{release-state}"=="unreleased"]
  74. Version {version} of Elasticsearch has not yet been released.
  75. endif::[]
  76. ifeval::["{release-state}"!="unreleased"]
  77. The Debian package for Elasticsearch v{version} can be downloaded from the website and installed as follows:
  78. ["source","sh",subs="attributes"]
  79. --------------------------------------------
  80. wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.deb
  81. sha1sum elasticsearch-{version}.deb <1>
  82. sudo dpkg -i elasticsearch-{version}.deb
  83. --------------------------------------------
  84. <1> Compare the SHA produced by `sha1sum` or `shasum` with the
  85. https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.deb.sha1[published SHA].
  86. endif::[]
  87. include::init-systemd.asciidoc[]
  88. [[deb-running-init]]
  89. ==== Running Elasticsearch with SysV `init`
  90. Use the `update-rc.d` command to configure Elasticsearch to start automatically
  91. when the system boots up:
  92. [source,sh]
  93. --------------------------------------------------
  94. sudo update-rc.d elasticsearch defaults 95 10
  95. --------------------------------------------------
  96. Elasticsearch can be started and stopped using the `service` command:
  97. [source,sh]
  98. --------------------------------------------
  99. sudo -i service elasticsearch start
  100. sudo -i service elasticsearch stop
  101. --------------------------------------------
  102. If Elasticsearch fails to start for any reason, it will print the reason for
  103. failure to STDOUT. Log files can be found in `/var/log/elasticsearch/`.
  104. [[deb-running-systemd]]
  105. include::systemd.asciidoc[]
  106. [[deb-check-running]]
  107. include::check-running.asciidoc[]
  108. [[deb-configuring]]
  109. ==== Configuring Elasticsearch
  110. Elasticsearch loads its configuration from the `/etc/elasticsearch/elasticsearch.yml`
  111. file by default. The format of this config file is explained in
  112. <<settings>>.
  113. The Debian package also has a system configuration file (`/etc/default/elasticsearch`),
  114. which allows you to set the following parameters:
  115. include::sysconfig-file.asciidoc[]
  116. NOTE: Distributions that use `systemd` require that system resource limits be
  117. configured via `systemd` rather than via the `/etc/sysconfig/elasticsearch`
  118. file. See <<systemd>> for more information.
  119. [[deb-layout]]
  120. ==== Directory layout of Debian package
  121. The Debian package places config files, logs, and the data directory in the appropriate
  122. locations for a Debian-based system:
  123. [cols="<h,<,<m,<m",options="header",]
  124. |=======================================================================
  125. | Type | Description | Default Location | Setting
  126. | home
  127. | Elasticsearch home directory or `$ES_HOME`
  128. | /usr/share/elasticsearch
  129. d|
  130. | bin
  131. | Binary scripts including `elasticsearch` to start a node
  132. and `elasticsearch-plugin` to install plugins
  133. | /usr/share/elasticsearch/bin
  134. d|
  135. | conf
  136. | Configuration files including `elasticsearch.yml`
  137. | /etc/elasticsearch
  138. | path.conf
  139. | conf
  140. | Environment variables including heap size, file descriptors.
  141. | /etc/default/elasticsearch
  142. d|
  143. | data
  144. | The location of the data files of each index / shard allocated
  145. on the node. Can hold multiple locations.
  146. | /var/lib/elasticsearch
  147. | path.data
  148. | logs
  149. | Log files location.
  150. | /var/log/elasticsearch
  151. | path.logs
  152. | plugins
  153. | Plugin files location. Each plugin will be contained in a subdirectory.
  154. | /usr/share/elasticsearch/plugins
  155. |
  156. | repo
  157. | 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.
  158. d| Not configured
  159. | path.repo
  160. |=======================================================================
  161. include::next-steps.asciidoc[]