How to Install and Configure Elasticsearch and Kibana on Ubuntu

How to Install and Configure Elasticsearch and Kibana on Ubuntu

Elasticsearch and Kibana are essential tools for managing and visualizing search and analytics data. If you're working with logs, metrics, or search-based applications, setting up these tools on your Ubuntu server is a great choice. In this guide, I'll walk you through the installation and configuration process step by step.

Step 1: Update Your System

First, ensure your system is up to date before proceeding with the installation:

sudo apt update
sudo apt upgrade -y        

Step 2: Install Java

Elasticsearch requires Java to run. Install OpenJDK 11 with the following command:

sudo apt install openjdk-11-jdk -y        

Verify the installation:

java -version        

Step 3: Add Elasticsearch Repository

Import the Elasticsearch GPG key:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -        

Now, add the official Elasticsearch repository to your system:

sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/8.x/apt stable main" > /etc/apt/sources.list.d/elastic-8.x.list'        

Update your package list:

sudo apt update        

Step 4: Install and Start Elasticsearch

Install Elasticsearch:

sudo apt install elasticsearch -y        

Verify if Elasticsearch is running:

sudo systemctl status elasticsearch        

Enable Elasticsearch to start on boot:

sudo systemctl enable elasticsearch        

Start the Elasticsearch service:

sudo systemctl start elasticsearch        

Check if Elasticsearch is running properly:

curl -X GET "localhost:9200/"        

Step 5: Configure Elasticsearch

Modify file permissions:

sudo chmod 0755 elasticsearch/        

Navigate to the configuration directory:

cd elasticsearch/        

Edit the Elasticsearch configuration file:

sudo nano elasticsearch.yml        

Once done, restart Elasticsearch:

cd ..
sudo systemctl restart elasticsearch
sudo systemctl daemon-reload        

Verify that Elasticsearch is running:

curl -X GET "localhost:9200/"        

Step 6: Install Kibana

Install Kibana with:

sudo apt install kibana -y        

Enable Kibana to start on boot:

sudo systemctl enable kibana        

Start the Kibana service:

sudo systemctl start kibana        

Check Kibana's status:

sudo systemctl status kibana        

Step 7: Configure Kibana

Navigate to the configuration directory:

cd /etc
ls -ltrh        

Modify permissions:

sudo chmod 0755 kibana/
cd kibana/        

Edit the Kibana configuration file:

sudo nano kibana.yml        

Find this line:

#server.host: "localhost"        

Uncomment it and modify it to:

server.host: "0.0.0.0"        

Save and exit (Press Ctrl + X, then Y, and hit Enter).

Step 8: Allow Firewall Ports

To ensure accessibility, allow necessary ports through the firewall:

sudo ufw allow 9200
sudo ufw allow 5601
sudo ufw enable        

Step 9: Access Kibana

Now, open your browser and access Kibana using:

https://<your_server_ip>:5601        

For local access, use:

https://localhost:5601        

Conclusion

You have successfully installed and configured Elasticsearch and Kibana on Ubuntu! These tools will help you analyze and visualize data efficiently. If you found this guide useful, feel free to share it with others in the tech community.

Asim Rasheed

??Aspiring DevOps & Cloud Engineer | AWS, Docker, CI/CD, Automation & Security | Linux & Cloud Infrastructure Specialist

1 个月

Interesting

回复
Muhammad Talha Nawaz

Linux Administrator | ?? Cloud Cybersecurity Specialist | ??? Ethical Hacker | ?? ISO 27001 Lead Implementer & Auditor | ?? SOC Analyst | Python | Cybersecurity Educator

1 个月

Very informative

Salman Qureshi

Agile Ai Operations Specialist | Researching in Cloud, Cybersecurity, DevOps, SysOps, and AI Integration

1 个月

very helpful, many people where facing alot of issues on how they can install ELK, i will be sharing this to them now, Thanks great work

要查看或添加评论,请登录

Abdullah bin Amin的更多文章

社区洞察

其他会员也浏览了