deb.asciidoc 7.3 KB

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