Set Up Elasticsearch and Kibana on CentOS 7

Updated Last updated: May 1, 2026 · Originally published: April 29, 2022

Real-Time Search and Analytics: The Challenge

📌 TL;DR: Real-Time Search and Analytics: The Challenge Picture this: your team is tasked with implementing a solid real-time search and analytics solution, but time isn’t on your side.
🎯 Quick Answer: Set up Elasticsearch and Kibana on CentOS 7 by importing the Elastic GPG key, adding the Elastic 7.x yum repo, then running yum install elasticsearch kibana. Configure network.host in elasticsearch.yml and server.host in kibana.yml, then enable both services with systemctl.

Picture this: your team is tasked with implementing a solid real-time search and analytics solution, but time isn’t on your side. You’ve got a CentOS 7 server at your disposal, and the pressure is mounting to get Elasticsearch and Kibana up and running quickly, securely, and efficiently. I’ve been there countless times, and through trial and error, I’ve learned exactly how to make this process smooth and sustainable. I’ll walk you through every essential step, with no shortcuts and actionable tips to avoid common pitfalls.

Step 1: Prepare Your System for Elasticsearch

Before diving into the installation, it’s critical to ensure your CentOS 7 environment is primed for Elasticsearch. Neglecting these prerequisites can lead to frustrating errors down the line. Trust me—spending an extra 10 minutes here will save you hours later. Let’s break this down step by step.

Networking Essentials

Networking is the backbone of any distributed system, and Elasticsearch clusters are no exception. To avoid future headaches, it’s important to configure networking properly from the start.

  • Set a static IP address:

    A dynamic IP can cause connectivity issues, especially in a cluster. Configure a static IP by editing the network configuration:

    sudo vi /etc/sysconfig/network-scripts/ifcfg-ens3

    Update the file to include settings for a static IP, then restart the network service:

    sudo systemctl restart network
    Pro Tip: Use ip addr to confirm the IP address has been set correctly.
  • Set a hostname:

    A clear, descriptive hostname helps with cluster management and debugging. Set a hostname like es-node1 using the following command:

    sudo hostnamectl set-hostname es-node1

    Don’t forget to update /etc/hosts to map the hostname to your static IP address.

Install Prerequisite Packages

Elasticsearch relies on several packages to function properly. Installing them upfront will ensure a smoother setup process.

  • Install essential utilities: Tools like wget and curl are needed for downloading files and testing connections:

    sudo yum install wget curl vim -y
  • Install Java: Elasticsearch requires Java to run. While Elasticsearch 8.x comes with a bundled JVM, it’s a good idea to have Java installed system-wide for flexibility:

    sudo yum install java-1.8.0-openjdk.x86_64 -y
    Warning: If you decide to use the bundled JVM, avoid setting JAVA_HOME to prevent conflicts.

Step 2: Install Elasticsearch 8.x on CentOS 7

Now that your system is ready, it’s time to install Elasticsearch. Version 8.x brings significant improvements, including built-in security features like TLS and authentication. Follow these steps carefully.

Adding the Elasticsearch Repository

The first step is to add the official Elasticsearch repository to your system. This ensures you’ll always have access to the latest version.

  1. Import the Elasticsearch GPG key:

    Verify the authenticity of the packages by importing the GPG key:

    sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
  2. Create the repository file:

    Add the Elastic repository by creating a new file:

    sudo vi /etc/yum.repos.d/elasticsearch.repo
    [elasticsearch]
    name=Elasticsearch repository for 8.x packages
    baseurl=https://artifacts.elastic.co/packages/8.x/yum
    gpgcheck=1
    gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
    enabled=0
    autorefresh=1
    type=rpm-md
    Pro Tip: Set enabled=0 to avoid accidental Elasticsearch updates during a system-wide yum update.

Installing and Configuring Elasticsearch

Once the repository is set up, you can proceed with the installation and configuration of Elasticsearch.

  1. Install Elasticsearch:

    Enable the repository and install Elasticsearch:

    sudo yum install --enablerepo=elasticsearch elasticsearch -y
  2. Configure Elasticsearch:

    Open the configuration file and make the following changes:

    sudo vi /etc/elasticsearch/elasticsearch.yml
    node.name: "es-node1"
    cluster.name: "my-cluster"
    network.host: 0.0.0.0
    discovery.seed_hosts: ["127.0.0.1"]
    xpack.security.enabled: true

    This configuration enables a single-node cluster with basic security.

  3. Set JVM heap size:

    Adjust the JVM heap size for Elasticsearch:

    sudo vi /etc/elasticsearch/jvm.options
    -Xms4g
    -Xmx4g
    Pro Tip: Set the heap size to half of your system’s RAM but do not exceed 32GB for best performance.
  4. Start Elasticsearch:

    Enable and start the Elasticsearch service:

    sudo systemctl enable elasticsearch
    sudo systemctl start elasticsearch
  5. Verify the installation:

    Test the Elasticsearch setup by running:

    curl -X GET 'http://localhost:9200'

Step 3: Install Kibana for Visualization

Kibana provides a user-friendly interface for interacting with Elasticsearch. It allows you to visualize data, monitor cluster health, and manage security settings.

Installing Kibana

Follow these steps to install and configure Kibana on CentOS 7:

  1. Add the Kibana repository:

    sudo vi /etc/yum.repos.d/kibana.repo
    [kibana-8.x]
    name=Kibana repository for 8.x packages
    baseurl=https://artifacts.elastic.co/packages/8.x/yum
    gpgcheck=1
    gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
    enabled=1
    autorefresh=1
    type=rpm-md
  2. Install Kibana:

    sudo yum install kibana -y
  3. Configure Kibana:

    sudo vi /etc/kibana/kibana.yml
    server.host: "0.0.0.0"
    elasticsearch.hosts: ["http://localhost:9200"]
    xpack.security.enabled: true
  4. Start Kibana:

    sudo systemctl enable kibana
    sudo systemctl start kibana
  5. Access Kibana:

    Visit http://your-server-ip:5601 in your browser and log in using the enrollment token.

Troubleshooting Common Issues

Even with a thorough setup, issues can arise. Here are some common problems and their solutions:

  • Elasticsearch won’t start: Check logs via journalctl -u elasticsearch for errors.
  • Kibana cannot connect: Verify the elasticsearch.hosts setting in kibana.yml and ensure Elasticsearch is running.
  • Cluster health is yellow: Add nodes or replicas to improve redundancy.

Quick Summary

  • Set up proper networking and prerequisites before installation.
  • Use meaningful names for clusters and nodes.
  • Enable Elasticsearch’s built-in security features.
  • Monitor cluster health regularly to address issues proactively.

By following this guide, you can confidently deploy Elasticsearch and Kibana on CentOS 7. Questions? Drop me a line—Max L.

🛠 Recommended Resources:

Tools and books mentioned in (or relevant to) this article:

📋 Disclosure: Some links are affiliate links. If you purchase through these links, I earn a small commission at no extra cost to you. I only recommend products I have personally used or thoroughly evaluated.


📚 Related Articles

📊 Free AI Market Intelligence

Join Alpha Signal — AI-powered market research delivered daily. Narrative detection, geopolitical risk scoring, sector rotation analysis.

Join Free on Telegram →

Pro with stock conviction scores: $5/mo

Get Weekly Security & DevOps Insights

Join 500+ engineers getting actionable tutorials on Kubernetes security, homelab builds, and trading automation. No spam, unsubscribe anytime.

Subscribe Free →

Delivered every Tuesday. Read by engineers at Google, AWS, and startups.

Frequently Asked Questions

What is Set Up Elasticsearch and Kibana on CentOS 7 about?

Real-Time Search and Analytics: The Challenge Picture this: your team is tasked with implementing a solid real-time search and analytics solution, but time isn’t on your side. You’ve got a CentOS 7 se

Who should read this article about Set Up Elasticsearch and Kibana on CentOS 7?

Anyone interested in learning about Set Up Elasticsearch and Kibana on CentOS 7 and related topics will find this article useful.

What are the key takeaways from Set Up Elasticsearch and Kibana on CentOS 7?

I’ve been there countless times, and through trial and error, I’ve learned exactly how to make this process smooth and sustainable. I’ll walk you through every essential step, with no shortcuts and ac

References

📧 Get weekly insights on security, trading, and tech. No spam, unsubscribe anytime.

Also by us: StartCaaS — AI Company OS · Hype2You — AI Tech Trends