Skip to content

Instantly share code, notes, and snippets.

@kolosek
Last active November 2, 2020 07:17
Show Gist options
  • Save kolosek/f2fcfbe645486901144b23d1cfc8c40f to your computer and use it in GitHub Desktop.
Save kolosek/f2fcfbe645486901144b23d1cfc8c40f to your computer and use it in GitHub Desktop.
echo "Requires JAVA installation"
read
sudo apt-get purge elasticsearch
sudo su -c "echo 'deb https://artifacts.elastic.co/packages/6.x/apt stable main'>> /etc/apt/sources.list.d/elastic-6.x.list"
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get update
sudo apt-get install elasticsearch
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service
@tamara-bol
Copy link

tamara-bol commented May 15, 2020

Additional notes:

  • If you need to downgrade version of elasticsearch, make sure the old instalation is completely removed:

sudo apt-get remove elasticsearch
sudo apt-get --purge elasticsearch

sudo rm -rf /var/lib/elasticsearch/
sudo rm -rf /etc/elasticsearch

For installing 5.6.12 version:

Download deb file from:
https://www.elastic.co/downloads/past-releases/elasticsearch-5-6-12

Install with:
sudo dpkg -i elasticsearch-5.6.12.deb

  • If you are getting an error after starting Elastic: ERROR: no log4j2.properties found,

It indicates that log4j2.properties file is missing.

Elastic will also show the location where he tries to find it, probably it is [/etc/elasticsearch].
You should run sudo -i, refer to that directory and create a file with adjusted properties:

appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%m%n

rootLogger.level = info
rootLogger.appenderRef.console.ref = console

@kolosek
Copy link
Author

kolosek commented Aug 17, 2020

In case permission is denied error:

sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch

@kolosek
Copy link
Author

kolosek commented Sep 22, 2020

Check if ElasticSearch is running and what version:

curl -XGET 'http://elasticsearch:9200/'

@kolosek
Copy link
Author

kolosek commented Nov 2, 2020

Running 2 versions of ES:

/Get the first ElasticSearch version

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.10.tar.gz

tar -zxf elasticsearch-5.6.10.tar.gz
//Get the second ElasticSearch version you would like to install

e.g. (if used one or another please adjuct directory location)
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.3-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.2.tar.gz

tar -zxf elasticsearch-6.8.2.tar.gz
//Configure the elasticsearch.yml file as follows

vim elasticsearch-5.6.10/config/elasticsearch.yml

cluster.name: elastic_cluster1
node.name: node-1
node.master: true
node.data: true
transport.host: localhost
transport.tcp.port: 9300
http.port: 9200
network.host: 0.0.0.0
//Configure elasticsearch.yml file for another ES version

vim elasticsearch-6.8.2/config/elasticsearch.yml
cluster.name: elastic_cluster2
node.name: node-2
#node.master: true
node.data: true
transport.host: localhost
transport.tcp.port: 9301
http.port: 9201
network.host: 0.0.0.0
//To start ElasticSearch Services from Terminal

cd elasticsearch-5.6.10
bin/elasticsearch -d

cd elasticsearch-6.8.2
bin/elasticsearch -d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment