Updated: 28 September 2026 · Applies to: Elasticsearch 9.x on cPanel & WHM servers running AlmaLinux, Rocky Linux or CloudLinux

Elasticsearch is a search and analytics engine that applications such as online shops and site search plugins use for fast full-text search. cPanel does not manage Elasticsearch, but you can install it from Elastic's own repository on the same server. This guide replaces older instructions for Elasticsearch 6 and Java 8 on CentOS: current versions bundle their own Java and turn on TLS and password login automatically. We tested it with Elasticsearch 9.5.4 on AlmaLinux 9.

Before you start

  • Memory: Elasticsearch needs its own RAM on top of Apache, PHP and MySQL. Plan at least 1 to 2 GB for it on a small server.
  • Version: check which search engine and version your application supports. Some applications need OpenSearch or an older Elasticsearch major version instead.

1. Add the Elastic repository

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

Create /etc/yum.repos.d/elasticsearch.repo:

[elasticsearch]
name=Elasticsearch repository for 9.x packages
baseurl=https://artifacts.elastic.co/packages/9.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
type=rpm-md

enabled=0 keeps the repository off for normal updates, so a routine dnf upgrade or cPanel update never moves Elasticsearch to a new version without you. You enable it only when you install or upgrade Elasticsearch.

2. Install

dnf install --enablerepo=elasticsearch elasticsearch

The installer prints a Security autoconfiguration information block with the generated password for the elastic user. Save it. If you lose it, reset it later with /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic.

3. Keep it private and limit its memory

The automatic configuration makes Elasticsearch listen on all network addresses (http.host: 0.0.0.0 in /etc/elasticsearch/elasticsearch.yml). When only applications on the same server use it, change that line to:

http.host: 127.0.0.1

Then set a fixed heap size, for example 1 GB, in a new file /etc/elasticsearch/jvm.options.d/heap.options:

-Xms1g
-Xmx1g

Use the same value for both lines and no more than half of the server's RAM. Without this file Elasticsearch sizes its heap from the total memory, which can leave too little for your websites.

4. Start and test

systemctl daemon-reload
systemctl enable --now elasticsearch
curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic https://localhost:9200

curl asks for the password and prints the node name and version ("number" : "9.5.4" in our test). Check that it listens only locally: ss -ltn | grep 9200 should show 127.0.0.1:9200.

5. Connect your application

Point the application to https://localhost:9200 with a user and password. Rather than the elastic superuser, create a user with only the rights the application needs (Elastic's documentation on users and roles explains how). If your firewall is CSF or firewalld, do not open port 9200.

Updating later

dnf upgrade --enablerepo=elasticsearch elasticsearch
systemctl restart elasticsearch

Read Elastic's release notes before a major version upgrade, and check that your application supports the new version first.

Need help?

Our cPanel server management team can install and tune Elasticsearch on your server, or you can hire an expert for a single task.

Official documentation: Install Elasticsearch with RPM (Elastic).

Was this answer helpful?

Still stuck? Open a ticket