-
Notifications
You must be signed in to change notification settings - Fork 0
/
elk_sh
53 lines (47 loc) · 2.42 KB
/
elk_sh
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
echo "System is updating and upgrading, please wait for a while"
apt-get update -y
apt-get upgrade -y
echo "Java installation is under process"
apt-get install default-jre -y
apt-get install default-jdk -y
echo "Creating a directory to download required packages"
mkdir /opt/elk
echo "Please wait, Packages are downloading"
wget --directory-prefix=/opt/elk https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.2.deb
wget --directory-prefix=/opt/elk https://artifacts.elastic.co/downloads/kibana/kibana-6.4.2-amd64.deb
wget --directory-prefix=/opt/elk https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-6.4.2-amd64.deb
wget --directory-prefix=/opt/elk https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.4.2-amd64.deb
echo "Making downloaded packages executable"
chmod +x /opt/elk/*
echo "Installation in under process, please wait for a while"
dpkg -i /opt/elk/elasticsearch-6.4.2.deb
dpkg -i /opt/elk/kibana-6.4.2-amd64.deb
dpkg -i /opt/elk/metricbeat-6.4.2-amd64.deb
dpkg -i /opt/elk/filebeat-6.4.2-amd64.deb
sed -i 's/#network.host: 192.168.0.1/network.host: localhost/g' /etc/elasticsearch/elasticsearch.yml
sed -i 's/#http.port: 9200/http.port: 9200/g' /etc/elasticsearch/elasticsearch.yml
systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl start elasticsearch.service
sed -i 's/#server.port: 5601/server.port: 5601/g' /etc/kibana/kibana.yml
sed -i 's/#server.host: "localhost"/server.host: "localhost"/g' /etc/kibana/kibana.yml
sed -i 's/#elasticsearch.url:/elasticsearch.url:/g' /etc/kibana/kibana.yml
systemctl daemon-reload
systemctl start kibana.service
systemctl enable kibana.service
wget -O /etc/metricbeat/metricbeat.yml https://raw.githubusercontent.com/aftab70/java/master/metricbeat_config
metricbeat modules enable system
wget -O /etc/metricbeat/modules.d/system.yml https://raw.githubusercontent.com/aftab70/java/master/metricbeat_system
systemctl start metricbeat.service
systemctl enable metricbeat.service
wget -O /etc/filebeat/filebeat.yml https://raw.githubusercontent.com/aftab70/java/master/filebeat_config
cd /usr/share/elasticsearch/
bin/elasticsearch-plugin install ingest-geoip
filebeat modules enable system
systemctl start filebeat.service
systemctl enable filebeat.service
echo "your installation is completed"
echo "elasticsearch url http://localhost:9200 "
echo "Kibana url http://localhost:5601"
echo "Metricbeat and filebeat configured with localhost"