-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelasticsearch7-install.sh
More file actions
32 lines (24 loc) · 983 Bytes
/
elasticsearch7-install.sh
File metadata and controls
32 lines (24 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# Update system
apt -y update
apt -y upgrade
apt install -y apt-transport-https
# Import Elasticsearch PGP Key
apt -y install gnupg
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
# Add APT repository
sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'
# Install Elasticsearch
apt -y update
apt -y install elasticsearch
# Set ES memory
sed -i 's/Xms2g/Xms512m/g' /etc/elasticsearch/jvm.options
sed -i 's/Xmx2g/Xmx512m/g' /etc/elasticsearch/jvm.options
# ES remote access
sed -i 's/#network.host: 192.168.0.1/network.host: 0.0.0.0/g' /etc/elasticsearch/elasticsearch.yml
# ES single node
sed -i 's/#discovery.seed_hosts: \[\"host1\", \"host2\"\]/discovery.seed_hosts: \[\"127.0.0.1\"\]/g' /etc/elasticsearch/elasticsearch.yml
systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl start elasticsearch.service
systemctl status elasticsearch.service