Install ElasticSearch on cPanel Servers

ElasticSearch is a powerful search engine that provides full schema-free JSON text search queries over a web interface. It’s multi-platform as it runs well on Linux and Windows operating systems. In order to work, it requires Java to be installed on your server. It’s also open source under the Apache license. Today we are going to show you how to install ElasticSearch on cPanel.

Tutorial: Install ElasticSearch on cPanel

Install Java 1.8

First, check the java version we have:

[[email protected]:~]java -version
java version "1.6.0_39"
OpenJDK Runtime Environment (IcedTea6 1.13.11) (rhel-1.13.11.1.el6_8-x86_64)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)


If it is less than 1.8, then remove Java so we can install the new version:
dnf remove java

Download Java latest RPM:

cd /usr/src
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u73-b02/jdk-8u73-linux-x64.rpm"
dnf localinstall jdk-8u73-linux-x64.rpm

Verify the new version running:

java -version

Example:

[[email protected]:~]java -version
java version "1.8.0_73"
Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)

Remove the dowloaded rpm file:

rm jdk-8u73-linux-x64.rpm -fv

Installing ElasticSearch on cPanel

Download the GPG-KEY:

rpm --import http://packages.elastic.co/GPG-KEY-elasticsearch

Let’s create elasticsearch repo inside yum:

nano -w /etc/yum.repos.d/elasticsearch.repo

Paste this content inside:

[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=http://packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1

Install ElasticSearch:

dnf install elasticsearch

If you need to tweak elasticsearch, you can do it by editing the main configuration file located at:

/etc/elasticsearch/elasticsearch.yml

Add the service to boot after OS starts, and start the service:

chkconfig --add elasticsearch
service elasticsearch start

Conclusion

Elasticsearch is a great search engine for your website, it’s simple and complex at the same time. It’s open source, support linux and windows, and have a great documentation where you can learn from the basics of the service, to advanced techniques and API integration.

As you saw, this can be easily installed on cPanel servers, you just need to verify you are running an updated version of Java, and that’s all.

Further reading:

 

About the Author: Martin Keler

Leave a Reply

Your email address will not be published. Required fields are marked *