deb.asciidoc 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. [[install-deb]]
  67. ==== Download and install the Debian package manually
  68. ifeval::["{release-state}"=="unreleased"]
  69. Version {version} of Elasticsearch has not yet been released.
  70. endif::[]
  71. ifeval::["{release-state}"!="unreleased"]
  72. The Debian package for Elastisearch v{version} can be downloaded from the website and installed as follows:
  73. ["source","sh",subs="attributes"]
  74. --------------------------------------------
  75. wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.deb
  76. sha1sum elasticsearch-{version}.deb <1>
  77. sudo dpkg -i elasticsearch-{version}.deb
  78. --------------------------------------------
  79. <1> Compare the SHA produced by `sha1sum` or `shasum` with the
  80. https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.deb.sha1[published SHA].
  81. endif::[]
  82. include::init-systemd.asciidoc[]
  83. [[deb-running-init]]
  84. ==== Running Elasticsearch with SysV `init`
  85. Use the `update-rc.d` command to configure Elasticsearch to start automatically
  86. when the system boots up:
  87. [source,sh]
  88. --------------------------------------------------
  89. sudo update-rc.d elasticsearch defaults 95 10
  90. --------------------------------------------------
  91. Elasticsearch can be started and stopped using the `service` command:
  92. [source,sh]
  93. --------------------------------------------
  94. sudo -i service elasticsearch start
  95. sudo -i service elasticsearch stop
  96. --------------------------------------------
  97. If Elasticsearch fails to start for any reason, it will print the reason for
  98. failure to STDOUT. Log files can be found in `/var/log/elasticsearch/`.
  99. [[deb-running-systemd]]
  100. include::systemd.asciidoc[]
  101. [[deb-check-running]]
  102. include::check-running.asciidoc[]
  103. [[deb-configuring]]
  104. ==== Configuring Elasticsearch
  105. Elasticsearch loads its configuration from the `/etc/elasticsearch/elasticsearch.yml`
  106. file by default. The format of this config file is explained in
  107. <<settings>>.
  108. The Debian package also has a system configuration file (`/etc/default/elasticsearch`),
  109. which allows you to set the following parameters:
  110. include::sysconfig-file.asciidoc[]
  111. NOTE: Distributions that use `systemd` require that system resource limits be
  112. configured via `systemd` rather than via the `/etc/sysconfig/elasticsearch`
  113. file. See <<systemd>> for more information.
  114. [[deb-layout]]
  115. ==== Directory layout of Debian package
  116. The Debian package places config files, logs, and the data directory in the appropriate
  117. locations for a Debian-based system:
  118. [cols="<h,<,<m,<m",options="header",]
  119. |=======================================================================
  120. | Type | Description | Default Location | Setting
  121. | home
  122. | Elasticsearch home directory or `$ES_HOME`
  123. | /usr/share/elasticsearch
  124. d|
  125. | bin
  126. | Binary scripts including `elasticsearch` to start a node
  127. and `elasticsearch-plugin` to install plugins
  128. | /usr/share/elasticsearch/bin
  129. d|
  130. | conf
  131. | Configuration files including `elasticsearch.yml`
  132. | /etc/elasticsearch
  133. | path.conf
  134. | conf
  135. | Environment variables including heap size, file descriptors.
  136. | /etc/default/elasticsearch
  137. d|
  138. | data
  139. | The location of the data files of each index / shard allocated
  140. on the node. Can hold multiple locations.
  141. | /var/lib/elasticsearch
  142. | path.data
  143. | logs
  144. | Log files location.
  145. | /var/log/elasticsearch
  146. | path.logs
  147. | plugins
  148. | Plugin files location. Each plugin will be contained in a subdirectory.
  149. | /usr/share/elasticsearch/plugins
  150. |
  151. | repo
  152. | 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.
  153. d| Not configured
  154. | path.repo
  155. | script
  156. | Location of script files.
  157. | /etc/elasticsearch/scripts
  158. | path.scripts
  159. |=======================================================================
  160. include::next-steps.asciidoc[]