Step-by-Step ELK Stack Installation and Configuration Guide
This article provides a detailed, command‑line walkthrough for installing Java, Elasticsearch, Logstash, and Kibana on Ubuntu, configuring each component with example configuration files, and verifying the ELK stack works by sending test data and querying the REST API.
This guide walks through installing and configuring the ELK stack (Elasticsearch, Logstash, Kibana) on an Ubuntu system, starting with the required Java runtime.
Java installation
Add the WebUpd8 PPA for Oracle Java:
su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installerVerify the installation:
java -version
javac -versionOptional: automatically accept the Oracle JDK8 license and set environment variables:
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 true | sudo debconf-set-selections
sudo apt-get install -y oracle-java8-set-defaultElasticsearch installation and configuration
Add the Elasticsearch GPG key and repository for the 5.x series:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list
sudo apt-get update
sudo apt-get install elasticsearchEdit /etc/elasticsearch/elasticsearch.yml with the following settings:
cluster.name: es_cluster_nik
node.name: nik
path.data: /tmp/elasticsearch/data
path.logs: /tmp/elasticsearch/logs
network.host: 0.0.0.0
http.port: 9200Start the Elasticsearch service:
service elasticsearch startLogstash installation and configuration
Install Logstash:
sudo apt-get install logstashCreate a test configuration file (e.g., /etc/logstash/conf.d/test.conf) that reads from standard input and writes to Elasticsearch with rubydebug output:
input { stdin { } }
output {
elasticsearch { hosts => "localhost:9200" index => "logstash_test" }
stdout { codec => rubydebug }
}Run Logstash with the test file:
/opt/logstash/bin/logstash -f /etc/logstash/conf.d/test.confType any string (e.g., teststring and so on) and observe the JSON output.
Kibana installation and configuration
Install Kibana (5.x):
sudo apt-get install kibanaEdit /etc/kibana/kibana.yml:
server.port: 5601
server.host: "192.168.1.10"
elasticsearch.url: http://192.168.1.10:9200Start Kibana:
service kibana startVerification
Query Elasticsearch to confirm Logstash indexed a document:
http://192.168.1.10:9200/logstash_test/_searchThe default index pattern can be accessed at http://192.168.1.10:9200/logstash-YYYY.MM.DD. Optional basic authentication can be configured by adding user => "logstash_internal" and password => "changeme" to the Logstash output block.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ThinkingAgent
Sharing the latest AI-native technologies and real-world implementations.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
