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.gpgEnsure you have the required apt-transport-https package:
sudo apt-get install apt-transport-httpsAdd 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.listUpdate your system's package list and install Elasticsearch:
sudo apt-get update && sudo apt-get install elasticsearchReload the system daemon and enable Elasticsearch to start on boot:
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.serviceStart Elasticsearch:
sudo systemctl start elasticsearch.serviceStop Elasticsearch:
sudo systemctl stop elasticsearch.serviceo allow modifications to the elasticsearch.yml file, update its permissions:
cd /etc
sudo chmod 777 elasticsearch/
cd elasticsearch
sudo chmod 777 elasticsearch.ymlgedit elasticsearch.ymlSet the required property from true to false as needed.
Restart the Elasticsearch service:
sudo systemctl restart elasticsearch.serviceCheck 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.