How to Install ELK Stack
Jul 25, 2026, 9:23 PM

Overview

The ELK Stack is a powerful trio of open-source tools—Elasticsearch, Logstash, and Kibana—designed to help you search, analyze, and visualize data in real-time. By combining these tools, you can transform raw log data into actionable insights. This guide will walk you through the installation process of ELK Stack on a Linux-based environment, making it accessible for both technical and non-technical readers.

What is ELK Stack?

Before diving into the installation, let’s break down the components of the ELK Stack:

  • Elasticsearch: A distributed search and analytics engine. Think of it as a highly efficient database tailored for searching and analyzing large volumes of data.
  • Logstash: A data processing pipeline that ingests data from various sources, transforms it, and sends it to a "stash" like Elasticsearch.
  • Kibana: A visualization tool that works on top of Elasticsearch. It provides a user interface to explore and visualize data through charts and dashboards.

Together, these components allow you to collect, store, and visualize data in a seamless manner.

System Requirements

Before starting the installation, ensure your system meets the following requirements:

RequirementDetails
OSLinux (Ubuntu, CentOS, etc.)
RAMMinimum 4 GB recommended
Disk SpaceAt least 10 GB free
JavaOpenJDK 11 or Oracle JDK 11

You can check your current Java version with the command:

java -version

If you don’t have Java installed, you can install OpenJDK using:

sudo apt update
sudo apt install openjdk-11-jdk

Step 1: Install Elasticsearch

Elasticsearch is the backbone of the ELK Stack. Here’s how to install it:

  1. Download and Install: First, add the Elasticsearch GPG key and repository.

    For Ubuntu, run:

    wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
    sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/8.x/apt stable main" > /etc/apt/sources.list.d/elastic-8.x.list'
    sudo apt update
    sudo apt install elasticsearch
    
  2. Start Elasticsearch: Start the service and enable it to run at boot.

    sudo systemctl start elasticsearch
    sudo systemctl enable elasticsearch
    
  3. Test Elasticsearch: You can verify that Elasticsearch is running by accessing it in your web browser or using curl.

    curl -X GET "localhost:9200/"
    

    You should see a JSON response containing your Elasticsearch cluster details.

Step 2: Install Logstash

Logstash will help you ingest and process data. Here’s how to install it:

  1. Install Logstash: Logstash can be installed from the same repository as Elasticsearch.

    sudo apt install logstash
    
  2. Configure Logstash: Create a configuration file to define the input, filter, and output. Below is a simple example that reads logs from a file and sends them to Elasticsearch.

    Create a file named logstash.conf in /etc/logstash/conf.d/:

    sudo nano /etc/logstash/conf.d/logstash.conf
    

    Add the following content:

    input {
        file {
            path => "/var/log/syslog"
            start_position => "beginning"
        }
    }
    
    filter {
        # Add any filters here if needed
    }
    
    output {
        elasticsearch {
            hosts => ["localhost:9200"]
            index => "syslog-%{+YYYY.MM.dd}"
        }
    }
    
  3. Start Logstash: Run Logstash to start processing logs.

    sudo systemctl start logstash
    sudo systemctl enable logstash
    

Step 3: Install Kibana

Kibana is the final piece of the puzzle, allowing you to visualize your data.

  1. Install Kibana: Just like Elasticsearch and Logstash, Kibana can be installed from the Elastic repository.

    sudo apt install kibana
    
  2. Start Kibana: Enable and start the Kibana service.

    sudo systemctl start kibana
    sudo systemctl enable kibana
    
  3. Access Kibana: Open your web browser and navigate to http://localhost:5601. You should see the Kibana dashboard.

Step 4: Verify the Setup

To ensure everything is working correctly, follow these steps:

  • In Kibana, go to the "Discover" section and select the index pattern you created (for example, syslog-*).
  • You should see logs being ingested in real-time.

Conclusion

Setting up the ELK Stack opens doors to powerful data analysis and visualization capabilities. By following these steps, you’ve installed Elasticsearch, Logstash, and Kibana, allowing you to start exploring your data immediately. Whether you’re troubleshooting issues or monitoring system performance, the ELK Stack is a versatile tool that can significantly enhance your data handling practices.