-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathElastic Seach Installation Steps.sh
158 lines (99 loc) · 3.62 KB
/
Elastic Seach Installation Steps.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
## Elastic Seach Installation Steps
sudo apt-get update -y
sudo apt-get install openjdk-11-jdk -y
sudo apt-get install wget curl gnupg2 apt-transport-https -y
# check java version
java -version
## Install and configure ElasticSearch on Ubuntu
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
sudo apt-get update -y
sudo apt-get install -y elasticsearch
## Do Modification on elastic search
sudo nano /etc/elasticsearch/elasticsearch.yml
## Change this
---Network Section---
network.host: localhost ## private ip
http.port: 9200
# add this line
--- Discovery ---
discovery.type: single-node
# Change this values from true to false
xpack.security.enabled: false
#save config file and exit
# start the elasticsearch service
sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch
sudo systemctl status elasticsearch
##################################################################
##Install and configure Kibana
sudo apt-get install kibana
## Do modification on kibana configuration file
sudo nano /etc/kibana/kibana.yml
# Remove '#' in the below lines;
server.port: 5601
server.host: "0.0.0.0" (Provide private ip)
elasticsearch.host: ["http://localhost:9200"]
# save this configuration file and exit
# start the kibana service
sudo systemctl start kibana
sudo systemctl enable kibana
sudo systemctl status kibana
####################################################
# Installing and Configure Logstash on ubuntu
sudo apt-get install logstash -y
# Create the below config file and insert below line to load logstash beat;
sudo tee /etc/logstash/conf.d/2-beats-input.conf <<EOF
input {
beats {
port => 5044
}
}
EOF
sudo tee /etc/logstash/conf.d/2-elasticsearch-output.conf <<EOF
output {
elasticsearch {
hosts => ["localhost:9200"]
manage_template => false
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%[+YYYY.MM.dd]"
}
}
EOF
# start the service for logstash
sudo systemctl start logstash
sudo systemctl enable logstash
sudo systemctl status logstash
#################################################################################33
# Install and configure Filebeat on ubuntu
sudo apt-get install filebeat
# Do modification on filebeat configuration file;
sudo nano /etc/filebeat/filebeat.yml
# comment the below lines
Output.elasticsearch:
Array of hosts to connect to.
hosts: ["localhost:9200"]
#Uncomment the below lines
output.logstash:
hosts: ["localhost:5044"]
# Start the Filebeat Service
sudo systemctl start filebeat
sudo systemctl enable filebeat
sudo systemctl status filebeat
# Enable filebeat system module
sudo filebeat modules enable system
# Enable filebeat logstash module
sudo filebeat modules enable logstash
sudo filebeat modules enable kibana
### Load the Index Template;
filebeat setup --index-management -E output.logstash.enabled=false -E 'output.elasticsearch.hosts=["localhost:9200"]'
sudo service filebeat start
## Check whether elasticsearch is receiving datalog from filebeat
curl -XGET http://localhost:9200/_cat/indicas?v
sudo filebeat setup --index-management -E output.logstash.enabled=false -E 'output.elasticsearch.hosts=["localhost"]'
sudo filebeat modules enable system
sudo filebeat modules enable apache
systemctl restart filebeat.service
filebeat test output
## Access the Kibana Web interface by using URL
echo http://locahost:5601
3.110.174.230:5601/app/home#/