Logo

How To Install Elasticsearch on Ubuntu 22.04

Jun 29, 2023

To install Elasticsearch on Ubuntu 22.04, you can follow these steps:

Step 1 : Import the Elasticsearch GPG key:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elastic.gpg

Step 2 : Add the Elasticsearch repository to the APT sources list:

echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list

This command adds the Elasticsearch 7.x repository to your sources list.

Step 3 : Update the package index:

sudo apt update

Step 4 : Install Elasticsearch:

sudo apt install elasticsearch

This command installs Elasticsearch and its dependencies.

Step 5 : Enable and start the Elasticsearch service:

sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch

This starts the Elasticsearch service and enables it to start automatically on system boot.

Step 6 : Verify that Elasticsearch is running:

curl -X GET "localhost:9200"

If Elasticsearch is running correctly, you will see output containing information about the Elasticsearch cluster.

Step 7 : Elasticsearch configuration files are located in the /etc/elasticsearch/ directory. You can edit the configuration as needed, but the default configuration should work for most cases.

You have successfully installed Elasticsearch on Ubuntu 22.04. Elasticsearch is now ready to use for search and analytics purposes.

Recommended