Operations 26 min read

Step‑by‑Step Guide to Installing and Configuring Elasticsearch 7.10 on CentOS 7

This article provides a comprehensive walkthrough for setting up Elasticsearch 7.10 on a CentOS 7 server, covering environment preparation, installation commands, verification steps, essential configuration of paths, cluster settings, JVM heap, system limits, and best‑practice recommendations for production deployments.

Raymond Ops
Raymond Ops
Raymond Ops
Step‑by‑Step Guide to Installing and Configuring Elasticsearch 7.10 on CentOS 7

Environment

CentOS‑7‑x86_64‑DVD‑2009.iso (https://mirrors.aliyun.com/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-2009.iso)

elasticsearch‑7.10.0‑linux‑x86_64.tar.gz (https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-10-0)

https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.0-linux-x86_64.tar.gz

Installation

# mkdir -p /usr/local/elasticsearch
# chown esuser:esuser /usr/local/elasticsearch
useradd esuser
passwd esuser
su - esuser
$ mv elasticsearch-7.10.0-linux-x86_64.tar.gz /usr/local/elasticsearch/
$ cd /usr/local/elasticsearch/
$ tar -xvzf elasticsearch-7.10.0-linux-x86_64.tar.gz
$ cd elasticsearch-7.10.0
$ ls
bin  config  jdk  lib  LICENSE.txt  logs  modules  NOTICE.txt  plugins  README.asciidoc

Note: By default Elasticsearch cannot be run as the root user and will fail with a RuntimeException.

Run in foreground

$ ./bin/elasticsearch

Verify the node is up:

$ curl localhost:9200/
{
  "name" : "localhost.localdomain",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "8CLFbx4LSwW_maztFPGiTg",
  "version" : {
    "number" : "7.10.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "51e9d6f22758d0374a0f3f5c6e8f3a7997850f96",
    "build_date" : "2020-11-09T21:30:33.964949Z",
    "build_snapshot" : false,
    "lucene_version" : "8.7.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

The address must match

config/elasticsearch.yml
network.host

settings.

Run as a daemon

$ ./bin/elasticsearch -d -p pid

Stop the daemon with pkill -F pid.

Reference links

https://www.elastic.co/guide/en/elasticsearch/reference/7.10/install-elasticsearch.html

https://www.elastic.co/guide/en/elasticsearch/reference/7.10/targz.html#install-linux

https://www.elastic.co/guide/en/elasticsearch/reference/7.10/targz.html#targz-running

Configuration

Important Elasticsearch configuration

Path configuration

Elasticsearch stores index data in the data directory and logs in the logs directory. In production it is recommended to place path.data and path.logs outside $ES_HOME.

path:
  data: /var/data/elasticsearch
  logs: /var/log/elasticsearch

Cluster name

Set a descriptive cluster.name (default is elasticsearch).

cluster.name: logging-prod

Node name

Define a readable node.name in elasticsearch.yml. By default it uses the host name.

node.name: prod-data-2

Network host

By default Elasticsearch binds to 127.0.0.1 and [::1]. To form a cluster across machines set network.host to the reachable IP.

network.host: 192.168.1.10

Discovery and cluster bootstrapping

Configure discovery.seed_hosts with the list of master‑eligible nodes and cluster.initial_master_nodes for the first cluster boot.

discovery.seed_hosts:
  - 192.168.1.10:9300
  - 192.168.1.11
  - seeds.mydomain.com
  - [0:0:0:0:ffff:c0a8:10c]:9301

cluster.initial_master_nodes:
  - master-node-a
  - master-node-b
  - master-node-c

Heap size

Set the JVM heap with equal -Xms and -Xmx values, typically 50 % of physical RAM but not exceeding the compressed‑oops limit.

-Xms2g
-Xmx2g

These options can be placed in $ES_HOME/config/jvm.options.d/ or supplied via the ES_JAVA_OPTS environment variable.

JVM heap dump path

Configure -XX:HeapDumpPath=… in jvm.options if the default location is unsuitable.

GC logging

Elasticsearch enables GC logging by default. Customise via JEP 158 options in jvm.options or disable with -Xlog:disable.

Temporary directory

Elasticsearch creates a private temporary directory under /tmp. Ensure the mount does not use noexec, or set a custom location with -Djna.tmpdir=<path>.

Swap disabling

Disable swap on Linux with sudo swapoff -a and comment out swap entries in /etc/fstab. For permanent disabling edit /etc/fstab or use system settings.

Memory lock

Enable bootstrap.memory_lock: true in elasticsearch.yml and grant the Elasticsearch user unlimited memlock (e.g., via /etc/security/limits.conf or systemd LimitMEMLOCK=infinity).

File descriptors

Increase the open file limit to at least 65536 for the Elasticsearch user (e.g., ulimit -n 65535 or nofile 65535 in /etc/security/limits.conf).

Thread limits

Ensure the user can create at least 4096 threads ( ulimit -u 4096 or nproc 4096 in limits.conf).

Virtual memory map count

Set vm.max_map_count to at least 262144 (e.g., sysctl -w vm.max_map_count=262144) and persist in /etc/sysctl.conf.

TCP retransmission timeout

Reduce Linux TCP retransmission attempts to speed up node‑failure detection: sysctl -w net.ipv4.tcp_reres2=5 and persist in /etc/sysctl.conf.

Reference links

https://www.elastic.co/guide/en/elasticsearch/reference/7.10/important-settings.html

https://www.elastic.co/guide/en/elasticsearch/reference/7.10/setting-system-settings.html

https://www.elastic.co/guide/en/elasticsearch/reference/7.10/setup-configuration-memory.html

https://www.elastic.co/guide/en/elasticsearch/reference/7.10/file-descriptors.html

https://www.elastic.co/guide/en/elasticsearch/reference/7.10/vm-max-map-count.html

https://www.elastic.co/guide/en/elasticsearch/reference/7.10/networkaddress-cache-ttl.html

JVMElasticsearchsystem settings
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.