deb.asciidoc 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. [[deb-key]]
  10. ==== Import the Elasticsearch PGP Key
  11. include::key.asciidoc[]
  12. [source,sh]
  13. -------------------------
  14. wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
  15. -------------------------
  16. [[deb-repo]]
  17. ==== Installing from the APT repository
  18. ifeval::["{release-state}"=="unreleased"]
  19. Version {version} of Elasticsearch has not yet been released.
  20. endif::[]
  21. ifeval::["{release-state}"!="unreleased"]
  22. You may need to install the `apt-transport-https` package on Debian before proceeding:
  23. [source,sh]
  24. --------------------------------------------------
  25. sudo apt-get install apt-transport-https
  26. --------------------------------------------------
  27. Save the repository definition to +/etc/apt/sources.list.d/elastic-{major-version}.list+:
  28. ifeval::["{release-state}"=="released"]
  29. ["source","sh",subs="attributes,callouts"]
  30. --------------------------------------------------
  31. 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
  32. --------------------------------------------------
  33. endif::[]
  34. ifeval::["{release-state}"=="prerelease"]
  35. ["source","sh",subs="attributes,callouts"]
  36. --------------------------------------------------
  37. echo "deb https://artifacts.elastic.co/packages/{major-version}/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-{major-version}.list
  38. --------------------------------------------------
  39. endif::[]
  40. [WARNING]
  41. ==================================================
  42. Do not use `add-apt-repository` as it will add a `deb-src` entry as well, but
  43. we do not provide a source package. If you have added the `deb-src` entry, you
  44. will see an error like the following:
  45. Unable to find expected entry 'main/source/Sources' in Release file
  46. (Wrong sources.list entry or malformed file)
  47. Delete the `deb-src` entry from the `/etc/apt/sources.list` file and the
  48. installation should work as expected.
  49. ==================================================
  50. You can install the Elasticsearch Debian package with:
  51. [source,sh]
  52. --------------------------------------------------
  53. sudo apt-get update && sudo apt-get install elasticsearch
  54. --------------------------------------------------
  55. [WARNING]
  56. ==================================================
  57. If two entries exist for the same Elasticsearch repository, you will see an error like this during `apt-get update`:
  58. ["literal",subs="attributes,callouts"]
  59. Duplicate sources.list entry https://artifacts.elastic.co/packages/{major-version}/apt/ ...`
  60. 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.
  61. ==================================================
  62. endif::[]
  63. [[install-deb]]
  64. ==== Download and install the Debian package manually
  65. ifeval::["{release-state}"=="unreleased"]
  66. Version {version} of Elasticsearch has not yet been released.
  67. endif::[]
  68. ifeval::["{release-state}"!="unreleased"]
  69. The Debian package for Elastisearch v{version} can be downloaded from the website and installed as follows:
  70. ["source","sh",subs="attributes"]
  71. --------------------------------------------
  72. wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.deb
  73. sha1sum elasticsearch-{version}.deb <1>
  74. sudo dpkg -i elasticsearch-{version}.deb
  75. --------------------------------------------
  76. <1> Compare the SHA produced by `sha1sum` or `shasum` with the
  77. https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.deb.sha1[published SHA].
  78. endif::[]
  79. include::init-systemd.asciidoc[]
  80. [[deb-running-init]]
  81. ==== Running Elasticsearch with SysV `init`
  82. Use the `update-rc.d` command to configure Elasticsearch to start automatically
  83. when the system boots up:
  84. [source,sh]
  85. --------------------------------------------------
  86. sudo update-rc.d elasticsearch defaults 95 10
  87. --------------------------------------------------
  88. Elasticsearch can be started and stopped using the `service` command:
  89. [source,sh]
  90. --------------------------------------------
  91. sudo -i service elasticsearch start
  92. sudo -i service elasticsearch stop
  93. --------------------------------------------
  94. If Elasticsearch fails to start for any reason, it will print the reason for
  95. failure to STDOUT. Log files can be found in `/var/log/elasticsearch/`.
  96. [[deb-running-systemd]]
  97. include::systemd.asciidoc[]
  98. [[deb-check-running]]
  99. include::check-running.asciidoc[]
  100. [[deb-configuring]]
  101. ==== Configuring Elasticsearch
  102. Elasticsearch loads its configuration from the `/etc/elasticsearch/elasticsearch.yml`
  103. file by default. The format of this config file is explained in
  104. <<settings>>.
  105. The Debian package also has a system configuration file (`/etc/default/elasticsearch`),
  106. which allows you to set the following parameters:
  107. include::sysconfig-file.asciidoc[]
  108. NOTE: Distributions that use `systemd` require that system resource limits be
  109. configured via `systemd` rather than via the `/etc/sysconfig/elasticsearch`
  110. file. See <<systemd>> for more information.
  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. | path.conf
  131. | conf
  132. | Environment variables including heap size, file descriptors.
  133. | /etc/default/elasticsearch
  134. d|
  135. | data
  136. | The location of the data files of each index / shard allocated
  137. on the node. Can hold multiple locations.
  138. | /var/lib/elasticsearch
  139. | path.data
  140. | logs
  141. | Log files location.
  142. | /var/log/elasticsearch
  143. | path.logs
  144. | plugins
  145. | Plugin files location. Each plugin will be contained in a subdirectory.
  146. | /usr/share/elasticsearch/plugins
  147. | repo
  148. | 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.
  149. d| Not configured
  150. | path.repo
  151. | script
  152. | Location of script files.
  153. | /etc/elasticsearch/scripts
  154. | path.scripts
  155. |=======================================================================
  156. include::next-steps.asciidoc[]