How to install Elasticsearch 6 on CentOS
In this tutorial, we will explain how to install Elasticsearch 6 on CentOS.
Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multi-tenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. Elasticsearch is developed in Java. Until more recent versions, following an open-core business model, parts of the software are licensed under various open source licenses (mostly the Apache License), while other parts fall under the commercial (source-available) Elastic License.
This tutorial is now older than 2 years and may contain outdated information. There might be inaccuracies due to major changes in the software described. You should rather consider this tutorial as a general guideline that may or may not work in your specific situation.
Prerequisites
In order to follow along this tutorial, you'll need
- A VPS running CentOS with sufficient memory and CPU resources (e.g. a VPS Premium)
Step 1 – Install OpenJDK
As Elasticsearch is written in Java, we need to install a Java Runtime Environment (JRE), first. For Elasticsearch 6, we'll use OpenJDK 8. If you are connected to your server using a non-root user, you'll need to prefix the following commands with sudo
to run them with elevated privileges. You can install it by running the following command:
sudo yum install java-1.8.0-openjdk.x86_64