How to install Elasticsearch on CentOS


Step 1: install java

Read: How to install Java on CentOS

or install easily by using this command:

yum install java

result:

[root@tutorialspots ~]# yum install java
Loaded plugins: fastestmirror
base                                                     | 3.6 kB     00:00
epel/x86_64/metalink                                     |  18 kB     00:00
epel                                                     | 4.7 kB     00:00
extras                                                   | 3.4 kB     00:00
mariadb                                                  | 2.9 kB     00:00
nginx                                                    | 2.9 kB     00:00
remi-php71                                               | 2.9 kB     00:00
remi-safe                                                | 2.9 kB     00:00
updates                                                  | 3.4 kB     00:00
(1/5): epel/x86_64/updateinfo                              | 908 kB   00:00
(2/5): epel/x86_64/primary_db                              | 6.3 MB   00:00
(3/5): remi-php71/primary_db                               | 217 kB   00:00
(4/5): remi-safe/primary_db                                | 1.2 MB   00:00
(5/5): updates/7/x86_64/primary_db                         | 6.9 MB   00:02
Loading mirror speeds from cached hostfile
 * base: mirror.tzulo.com
 * epel: mirror.grid.uchicago.edu
 * extras: mirrordenver.fdcservers.net
 * remi-php71: repo1.dal.innoscale.net
 * remi-safe: repo1.dal.innoscale.net
 * updates: bay.uchicago.edu
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.161-0.b14.el7_4 will be installed
--> Processing Dependency: java-1.8.0-openjdk-headless(x86-64) = 1:1.8.0.161-0.b
14.el7_4 for package: 1:java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64
--> Processing Dependency: xorg-x11-fonts-Type1 for package: 1:java-1.8.0-openjd
k-1.8.0.161-0.b14.el7_4.x86_64
--> Processing Dependency: libjvm.so(SUNWprivate_1.1)(64bit) for package: 1:java
-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64
--> Processing Dependency: libjli.so(SUNWprivate_1.1)(64bit) for package: 1:java
-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64
--> Processing Dependency: libjava.so(SUNWprivate_1.1)(64bit) for package: 1:jav
a-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64
--> Processing Dependency: libjvm.so()(64bit) for package: 1:java-1.8.0-openjdk-
1.8.0.161-0.b14.el7_4.x86_64
--> Processing Dependency: libjli.so()(64bit) for package: 1:java-1.8.0-openjdk-
1.8.0.161-0.b14.el7_4.x86_64
--> Processing Dependency: libjava.so()(64bit) for package: 1:java-1.8.0-openjdk
-1.8.0.161-0.b14.el7_4.x86_64
--> Processing Dependency: libgif.so.4()(64bit) for package: 1:java-1.8.0-openjd
k-1.8.0.161-0.b14.el7_4.x86_64
--> Processing Dependency: libawt.so()(64bit) for package: 1:java-1.8.0-openjdk-
1.8.0.161-0.b14.el7_4.x86_64
--> Processing Dependency: libXtst.so.6()(64bit) for package: 1:java-1.8.0-openj
dk-1.8.0.161-0.b14.el7_4.x86_64
--> Running transaction check
---> Package giflib.x86_64 0:4.1.6-9.el7 will be installed
---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.161-0.b14.el7_4 will be
installed
--> Processing Dependency: tzdata-java >= 2015d for package: 1:java-1.8.0-openjd
k-headless-1.8.0.161-0.b14.el7_4.x86_64
--> Processing Dependency: copy-jdk-configs >= 2.2 for package: 1:java-1.8.0-ope
njdk-headless-1.8.0.161-0.b14.el7_4.x86_64
--> Processing Dependency: lksctp-tools(x86-64) for package: 1:java-1.8.0-openjd
k-headless-1.8.0.161-0.b14.el7_4.x86_64
--> Processing Dependency: jpackage-utils for package: 1:java-1.8.0-openjdk-head
less-1.8.0.161-0.b14.el7_4.x86_64
---> Package libXtst.x86_64 0:1.2.3-1.el7 will be installed
---> Package xorg-x11-fonts-Type1.noarch 0:7.5-9.el7 will be installed
--> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.
noarch
--> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.
noarch
--> Running transaction check
---> Package copy-jdk-configs.noarch 0:2.2-5.el7_4 will be installed
---> Package javapackages-tools.noarch 0:3.4.1-11.el7 will be installed
--> Processing Dependency: python-javapackages = 3.4.1-11.el7 for package: javap
ackages-tools-3.4.1-11.el7.noarch
---> Package lksctp-tools.x86_64 0:1.0.17-2.el7 will be installed
---> Package ttmkfdir.x86_64 0:3.0.9-42.el7 will be installed
---> Package tzdata-java.noarch 0:2018d-1.el7 will be installed
--> Running transaction check
---> Package python-javapackages.noarch 0:3.4.1-11.el7 will be installed
--> Processing Dependency: python-lxml for package: python-javapackages-3.4.1-11
.el7.noarch
--> Running transaction check
---> Package python-lxml.x86_64 0:3.2.1-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                      Arch    Version                    Repository
                                                                           Size
================================================================================
Installing:
 java-1.8.0-openjdk           x86_64  1:1.8.0.161-0.b14.el7_4    updates  243 k
Installing for dependencies:
 copy-jdk-configs             noarch  2.2-5.el7_4                updates   19 k
 giflib                       x86_64  4.1.6-9.el7                base      40 k
 java-1.8.0-openjdk-headless  x86_64  1:1.8.0.161-0.b14.el7_4    updates   32 M
 javapackages-tools           noarch  3.4.1-11.el7               base      73 k
 libXtst                      x86_64  1.2.3-1.el7                base      20 k
 lksctp-tools                 x86_64  1.0.17-2.el7               base      88 k
 python-javapackages          noarch  3.4.1-11.el7               base      31 k
 python-lxml                  x86_64  3.2.1-4.el7                base     758 k
 ttmkfdir                     x86_64  3.0.9-42.el7               base      48 k
 tzdata-java                  noarch  2018d-1.el7                updates  184 k
 xorg-x11-fonts-Type1         noarch  7.5-9.el7                  base     521 k

Transaction Summary
================================================================================
Install  1 Package (+11 Dependent packages)

Total download size: 34 M
Installed size: 108 M
Is this ok [y/d/N]: y
Downloading packages:
(1/12): giflib-4.1.6-9.el7.x86_64.rpm                      |  40 kB   00:00
(2/12): copy-jdk-configs-2.2-5.el7_4.noarch.rpm            |  19 kB   00:00
(3/12): javapackages-tools-3.4.1-11.el7.noarch.rpm         |  73 kB   00:00
(4/12): python-javapackages-3.4.1-11.el7.noarch.rpm        |  31 kB   00:00
(5/12): libXtst-1.2.3-1.el7.x86_64.rpm                     |  20 kB   00:00
(6/12): ttmkfdir-3.0.9-42.el7.x86_64.rpm                   |  48 kB   00:00
(7/12): python-lxml-3.2.1-4.el7.x86_64.rpm                 | 758 kB   00:00
(8/12): lksctp-tools-1.0.17-2.el7.x86_64.rpm               |  88 kB   00:00
(9/12): java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64.rp | 243 kB   00:00
(10/12): xorg-x11-fonts-Type1-7.5-9.el7.noarch.rpm         | 521 kB   00:00
(11/12): tzdata-java-2018d-1.el7.noarch.rpm                | 184 kB   00:00
(12/12): java-1.8.0-openjdk-headless-1.8.0.161-0.b14.el7_4 |  32 MB   00:04
--------------------------------------------------------------------------------
Total                                              7.5 MB/s |  34 MB  00:04
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : ttmkfdir-3.0.9-42.el7.x86_64                                1/12
  Installing : xorg-x11-fonts-Type1-7.5-9.el7.noarch                       2/12
  Installing : lksctp-tools-1.0.17-2.el7.x86_64                            3/12
  Installing : libXtst-1.2.3-1.el7.x86_64                                  4/12
  Installing : python-lxml-3.2.1-4.el7.x86_64                              5/12
  Installing : python-javapackages-3.4.1-11.el7.noarch                     6/12
  Installing : javapackages-tools-3.4.1-11.el7.noarch                      7/12
  Installing : giflib-4.1.6-9.el7.x86_64                                   8/12
  Installing : tzdata-java-2018d-1.el7.noarch                              9/12
  Installing : copy-jdk-configs-2.2-5.el7_4.noarch                        10/12
  Installing : 1:java-1.8.0-openjdk-headless-1.8.0.161-0.b14.el7_4.x86_   11/12
  Installing : 1:java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64          12/12
  Verifying  : copy-jdk-configs-2.2-5.el7_4.noarch                         1/12
  Verifying  : 1:java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64           2/12
  Verifying  : tzdata-java-2018d-1.el7.noarch                              3/12
  Verifying  : giflib-4.1.6-9.el7.x86_64                                   4/12
  Verifying  : xorg-x11-fonts-Type1-7.5-9.el7.noarch                       5/12
  Verifying  : python-javapackages-3.4.1-11.el7.noarch                     6/12
  Verifying  : python-lxml-3.2.1-4.el7.x86_64                              7/12
  Verifying  : 1:java-1.8.0-openjdk-headless-1.8.0.161-0.b14.el7_4.x86_    8/12
  Verifying  : libXtst-1.2.3-1.el7.x86_64                                  9/12
  Verifying  : javapackages-tools-3.4.1-11.el7.noarch                     10/12
  Verifying  : lksctp-tools-1.0.17-2.el7.x86_64                           11/12
  Verifying  : ttmkfdir-3.0.9-42.el7.x86_64                               12/12

Installed:
  java-1.8.0-openjdk.x86_64 1:1.8.0.161-0.b14.el7_4

Dependency Installed:
  copy-jdk-configs.noarch 0:2.2-5.el7_4
  giflib.x86_64 0:4.1.6-9.el7
  java-1.8.0-openjdk-headless.x86_64 1:1.8.0.161-0.b14.el7_4
  javapackages-tools.noarch 0:3.4.1-11.el7
  libXtst.x86_64 0:1.2.3-1.el7
  lksctp-tools.x86_64 0:1.0.17-2.el7
  python-javapackages.noarch 0:3.4.1-11.el7
  python-lxml.x86_64 0:3.2.1-4.el7
  ttmkfdir.x86_64 0:3.0.9-42.el7
  tzdata-java.noarch 0:2018d-1.el7
  xorg-x11-fonts-Type1.noarch 0:7.5-9.el7

Complete!

Step 2: install Elasticsearch

rpm -ivh https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.rpm

Step 3:

systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl start elasticsearch.service

Done! Check

[root@tutorialspots ~]# curl http://localhost:9200
{
  "name" : "xGTksWR",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "wpdPMEalTBWbxCE-ddMMMQ",
  "version" : {
    "number" : "6.2.3",
    "build_hash" : "c59ff00",
    "build_date" : "2018-03-13T10:06:29.741383Z",
    "build_snapshot" : false,
    "lucene_version" : "7.2.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

Leave a Reply