Install and Configure Elasticsearch 8 on Ubuntu 22.04

Sep 21, 2022 . Admin



Hi Guys,

If you need to see example of Install and Configure Elasticsearch 8 on Ubuntu 22.04. I explained simply step by step ubuntu 22.04 install elasticsearch 8 Code Example . This post will give you simple example of Best Method Installation Elasticsearch on Ubuntu 20.04. you can see 4 ways to Installing Elasticsearch 8 on Ubuntu. Let's see bellow example Tutorial Install Elasticsearch on Ubuntu 22.04 - Blog.

You can use this post for ubuntu 14.04, ubuntu 16.04, ubuntu 18.4, ubuntu 20.04, ubuntu 21 and ubuntu 22.04 versions.

Just follow the following steps to install and configure elasticsearch 8 on Linux ubuntu 22.04:

Step 1: Update System Dependencies

First of all, open terminal or command line and execute the following command on command line to update system dependencies:

sudo apt update
sudo apt upgrade -y

The following packages must install and use Elasticsearch; ensure these are installed using the following command.

sudo apt install -y vim wget
Step 2: Import the Elasticsearch PGP Key

Elasticsearch signs all of our packages with the Elasticsearch Signing Key (PGP key D88E42B4, available from https://pgp.mit.edu) with fingerprint:

4609 5ACC 8548 582C 1A26 99A9 D27D 666C D88E 42B4

Download and install the public signing key:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
Step 3: Install Elasticsearch from the APT repository

Run the following command on command line to install the Elasticsearch package:

echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
sudo apt-get update && sudo apt-get install elasticsearch
Step 4: Start and Enable the Elasticsearch Service

To start Elasticsearch service, issue this command:

sudo systemctl start elasticsearch

After that execute the following command on command line to enable the service on boot:

sudo systemctl enable elasticsearch
Step 5: Verify Elasticsearch

To verify ElasticSearch is started and listening on port 9200:

ss -antpl | grep 9200
Step 6: Use Elasticsearch

Then use the following command with Curl command to add data to the ElasticSearch; is as follows:

sudo curl -H 'Content-Type: application/json' -X POST --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic 'http://localhost:9200/todo/task/1' -d '{ "name": "Go to the mall." }'

You should see the following output after entering the password:

{"_index":"todo","_type":"task","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1}
#Ubuntu