How To Install Elastic Stack

Intro How To Install Elastic Stack

這篇介紹How To Install Elastic Stack.

Add User ELK

1
$ sudo adduser -U -p somepasswords elk

Install Zulu JDK

1
2
3
4
$ cd /usr/local
$ wget https://cdn.azul.com/zulu/bin/zulu8.62.0.19-ca-jdk8.0.332-linux_x64.tar.gz
$ tar zxvf zulu8.62.0.19-ca-jdk8.0.332-linux_x64.tar.gz
$ ln -sfn zulu8.62.0.19-ca-jdk8.0.332-linux_x64 java

Install ElasticSearch 7.3.2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ mkdir /home/elk/binary-7.3.2
$ mkdir /var/data/elasticsearch-7.3.2
$ cd /home/elk/binary-7.3.2
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.2-linux-x86_64.tar.gz
$ tar zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz

/* add env variable */
$ vi /etc/sysctl.conf
[ vm.max_map_count=655360 ]
$ sysctl -p

/* check nofile more than 65535 */
$ vi /etc/security/limits.conf
[
elk soft nofile 65536
elk hard nofile 65536
]

/* change folder previlige */
$ chown -R elk:elk /home/elk/binary-7.3.2
$ chown -R elk:elk /var/data/elasticsearch-7.3.2

Modify config/elasticsearch.yml

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
33
#cluster name
cluster.name: nv-es

#node name
node.name: node1

#data store path
path.data: /var/data/elasticsearch-7.3.2

#inbound bind address
network.host: 0.0.0.0

#outbound bin address
network.publish_host: 192.168.x.x

#api port
http.port: 9200

#node communication port
transport.tcp.port: 9300

#node discover host list
discovery.seed_hosts: ["someIP:9300"]

#initial master node
cluster.initial_master_nodes: ["someIP"]

#enalbe security
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

#enable monitor
xpack.monitoring.collection.enabled: true

Modify config/jvm.options

1
2
3
4
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms1g
-Xmx1g

Startup ElasticSearch in daemon mode

1
2
$ cd /home/elk/binary-7.3.2/elasticsearch-7.3.2
$ ./bin/elasticsearch -d

Setup buildin user password

1
$ ./bin/elasticsearch-setup-passwords interactive

Kibana installation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Download kibana
$ cd /home/elk/binary-7.3.2
$ wget https://artifacts.elastic.co/downloads/kibana/kibana-7.3.2-linux-x86_64.tar.gz
$ tar zxvf kibana-7.3.2-linux-x86_64.tar.gz

Modify config/kibana.yml
# lister port
server.port: 5601

# inbound bind port
server.host: "0.0.0.0"

# setup elasticsearch connection info
elasticsearch.hosts: ["http://127.0.0.1:9200"]
elasticsearch.username: "kibana"
elasticsearch.password: "somepasswords"

# log path
logging.dest: logs/kibana.log

Startup kibana in daemon mode
$ ./bin/kibana &