Centos7安裝ELK6.5.4
1、預(yù)安裝JDK8
2脐雪、禁用SELinux
原因:kibana始終都是報(bào)Nginx502Bad
3、安裝ES
# 導(dǎo)入秘鑰
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
# 下載rpm源
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.4.rpm
# 安裝
rpm -ivh elasticsearch-6.5.4.rpm
# 配置elasticsearch.yml
vim /etc/elasticsearch/elasticsearch.yml
# 取消下面兩行的注釋
bootstrap.memory_lock: true # 設(shè)置堆大小為可用內(nèi)存的一半左右
http.port: 9200
# 重新加載配置文件
systemctl daemon-reload
# 設(shè)置自啟
systemctl enable elasticsearch
# 啟動
systemctl start elasticsearch
# 查看是否啟動成功: 9200端口
netstat -plntu
4疼邀、安裝Nginx
# 安裝軟件倉庫EPEL,用于yum install xxx提供軟件包
yum install -y epel-release
# 安裝Nginx及依賴模塊
yum install nginx httpd-tools -y
# 刪除配置
vim /etc/nginx/nginx.conf
# 刪除80端口的server{}配置
# 創(chuàng)建kibana代理
vim /etc/nginx/conf.d/kibana.conf
# 添加nginx配置
server {
listen 80;
server_name elk-stack.co;
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/.kibana-user;
location / {
proxy_pass http://localhost:5601;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
} }
# 創(chuàng)建elasticsearch代理
vim /etc/nginx/conf.d/elasticsearch.conf
# 添加nginx配置
server {
listen 81;
server_name elk-stack.co;
location / {
proxy_pass http://localhost:9200;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
} }
# 添加basic認(rèn)證
htpasswd -c /etc/nginx/.kibana-user admin
# 檢測nginx配置文件
nginx -t
# 設(shè)置開機(jī)自啟
systemctl enable nginx
# 啟動Nginx
systemctl start nginx
5喂江、安裝Kibana
# 下載rpm源
wget https://artifacts.elastic.co/downloads/kibana/kibana-6.5.4-x86_64.rpm
# 安裝kibana
rpm -ivh kibana-6.5.4-x86_64.rpm
# 修改配置
vim /etc/kibana/kibana.yml
# 取消以下三行的注釋
server.port: 5601
server.host: "localhost"
elasticsearch.url: "http://localhost:9200"
# 設(shè)置開機(jī)自啟
systemctl enable kibana
# 啟動Kibana
systemctl start kibana
# 查看是否啟動成功:5601端口
netstat -plntu
6、安裝Logstash
# 下載rpm源
wget https://artifacts.elastic.co/downloads/logstash/logstash-6.5.4.rpm
# 安裝
rpm -ivh logstash-6.5.4.rpm
# 設(shè)置開機(jī)自啟
systemctl enable logstash
# 啟動
systemctl start logstash
# 開放防火墻
firewall-cmd --zone=public --add-port=80/tcp --add-port=81/tcp --permanent
firewall-cmd --reload