Follow these steps to install and configure Elasticsearch on your system.
To ensure the authenticity of the Elasticsearch packages, add the GPG key:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
Ensure you have the required apt-transport-https package:
sudo apt-get install apt-transport-https
Add the official Elasticsearch APT repository to your sources list:
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
Update your system's package list and install Elasticsearch:
sudo apt-get update && sudo apt-get install elasticsearch
Reload the system daemon and enable Elasticsearch to start on boot:
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
Start Elasticsearch:
sudo systemctl start elasticsearch.service
Stop Elasticsearch:
sudo systemctl stop elasticsearch.service
o allow modifications to the elasticsearch.yml file, update its permissions:
cd /etc
sudo chmod 777 elasticsearch/
cd elasticsearch
sudo chmod 777 elasticsearch.yml
gedit elasticsearch.yml
Set the required property from true to false as needed.
Restart the Elasticsearch service:
sudo systemctl restart elasticsearch.service
Check if Elasticsearch is running successfully by accessing the following URL in your browser:
You should see a JSON response confirming that Elasticsearch is up and running.