From 677c870b76a3460595bcb4eeba9725db361781ac Mon Sep 17 00:00:00 2001 From: Kaimbacher Date: Fri, 1 Jul 2022 09:13:33 +0000 Subject: [PATCH] Update 'Install_Configure_ElasticSearch' --- Install_Configure_ElasticSearch.md | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Install_Configure_ElasticSearch.md diff --git a/Install_Configure_ElasticSearch.md b/Install_Configure_ElasticSearch.md new file mode 100644 index 0000000..193b2a3 --- /dev/null +++ b/Install_Configure_ElasticSearch.md @@ -0,0 +1,45 @@ +Elasticsearch is a platform for distributed search and analysis of data in real time. It is a popular choice due to its usability, powerful features, and scalability. + +This article will guide you through installing Elasticsearch, configuring it for your use case, securing your installation, and beginning to work with your Elasticsearch server. + +# Step 1: Installing Elasticsearch +To begin, use cURL, the command line tool for transferring data with URLs, to import the Elasticsearch public GPG key into APT. Note that we are using the arguments -fsSL to silence all progress and possible errors (except for a server failure) and to allow cURL to make a request on a new location if redirected. Pipe the output to the gpg --dearmor command, which converts the key into a format that apt can use to verify downloaded packages. + +`curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elastic.gpg` + +Next, add the Elastic source list to the sources.list.d directory, where apt will search for new sources: + +`echo "deb [signed-by=/usr/share/keyrings/elastic.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list` + +Next, update your package lists so APT will read the new Elastic source: + +`sudo apt update` + +Then install Elasticsearch with this command: +sudo apt install elasticsearch + +# Step2: Configuring ElasticSearch +o configure Elasticsearch, we will edit its main configuration file elasticsearch.yml where most of its configuration options are stored. This file is located in the /etc/elasticsearch directory. + +`sudo nano /etc/elasticsearch/elasticsearch.yml` + + +lasticsearch listens for traffic from everywhere on port 9200. You will want to restrict outside access to your Elasticsearch instance to prevent outsiders from reading your data or shutting down your Elasticsearch cluster through its [REST API](https://en.wikipedia.org/wiki/Representational_state_transfer). To restrict access and therefore increase security, find the line that specifies network.host, uncomment it, and replace its value with localhost so it reads like this: + +``` yml +. . . +# ---------------------------------- Network ----------------------------------- +# +# Set the bind address to a specific IP (IPv4 or IPv6): +# +network.host: localhost +. . . +``` + +These are the minimum settings you can start with in order to use Elasticsearch. Now you can start Elasticsearch for the first time. + +Start the Elasticsearch service with systemctl. Give Elasticsearch a few moments to start up. Otherwise, you may get errors about not being able to connect. \ +`sudo systemctl start elasticsearch` + +Next, run the following command to enable Elasticsearch to start up every time your server boots: \ +`sudo systemctl enable elasticsearch` \ No newline at end of file