Your cart is currently empty!
How to Install Elasticsearch on Ubuntu
Elasticsearch is a powerful, open-source search and analytics engine. It’s used for everything from full-text search to log analysis, and it powers big names like Wikipedia and Netflix. If you’re running Ubuntu and want Elasticsearch up and running, here’s how to do it—fast and frustration-free.
Prerequisites
- Ubuntu 20.04 or newer (older versions work, but these steps are for recent releases)
- sudo/root access
- Java 17+ (Elasticsearch needs it; we’ll handle this below)
Step 1: Update Your System
First things first—update your package index:
sudo apt update
sudo apt upgrade -y
Step 2: Install Java
Elasticsearch runs on Java. OpenJDK 17 works fine:
sudo apt install openjdk-17-jdk -y
Verify the installation:
java -version
You should see output confirming Java 17 or newer is installed.
Step 3: Import the Elasticsearch GPG Key
For security, add the official Elasticsearch GPG key:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Step 4: Add the Elasticsearch Repository
Add the Elastic APT repository to your sources list:
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 index again:
sudo apt update
Step 5: Install Elasticsearch
Now, install Elasticsearch:
sudo apt install elasticsearch -y
Step 6: Configure Elasticsearch (Optional)
You can tweak basic settings before starting Elasticsearch. The config file is here:
sudo nano /etc/elasticsearch/elasticsearch.yml
Common changes:
network.host: 0.0.0.0
— Listen on all network interfaces (for remote access)cluster.name: my-application
— Name your cluster
Save and close the file when you’re done.
Step 7: Start and Enable the Elasticsearch Service
Kick things off and make sure Elasticsearch starts on boot:
sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch
Check its status:
sudo systemctl status elasticsearch
You should see “active (running)”.
Step 8: Test Elasticsearch
By default, Elasticsearch listens on port 9200. Test it:
curl -X GET "localhost:9200/"
You should see a JSON response with the cluster name and version.
Wrapping Up
Elasticsearch is now running on your Ubuntu machine. You’re ready to index and search data, or plug Elasticsearch into your app or log management tool. For deeper configs and security settings, check out the official docs.
Need to install Kibana, set up security, or connect Elasticsearch to Logstash? Drop a comment or reach out for the next steps!
Tech enthusiast and content creator passionate about making technology simple for everyone. I share practical tips, guides, and reviews on the latest in computers, software, and gadgets. Let’s explore the digital world together!