1. Install the latest Java Runtime Environment.

    # yum install -y java-1.8.0-openjdk
  2. Add Elasticsearch repository to yum.
    1. Download and install the public signing key.

      # rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
    2. Add the following lines to /etc/yum.repos.d/elasticsearch.repo.

      [elasticsearch-6.x]
      name=Elasticsearch repository for 6.x packages
      baseurl=https://artifacts.elastic.co/packages/6.x/yum
      gpgcheck=1
      gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
      enabled=1
      autorefresh=1
      type=rpm-md
  3. Install Elasticsearch package along with dependencies.

    # yum install -y elasticsearch
  4. Configure Elasticsearch if necessary by editing /etc/elasticsearch/elasticsearch.yml.
  5. Configure firewall for Elasticsearch service.
    1. Enable network access to port 9200and 9300.

      # firewall-cmd --permanent --add-port=9200/tcp
      # firewall-cmd --permanent --add-port=9300/tcp
    2. Reload firewall rules and keep state information.

      # firewall-cmd --reload
  6. Configure Elasticsearch service to automatically start during boot.

    # systemctl enable elasticsearch
  7. Start Elasticsearch service.

    # systemctl start elasticsearch

    The service will take a while to start

  8. Test if installation is successful.

    $ curl 127.0.0.1:9200
    {
      "name" : "8v4rGQI",
      "cluster_name" : "elasticsearch",
      "cluster_uuid" : "nkZIqfkpSyCdh_jg3nqWfw",
      "version" : {
        "number" : "6.2.2",
        "build_hash" : "10b1edd",
        "build_date" : "2018-02-16T19:01:30.685723Z",
        "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"
    }