Centos7安裝ELK6.5.4

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

# 啟動(dòng)
systemctl start elasticsearch

# 查看是否啟動(dòng)成功: 9200端口
netstat -plntu

4、安裝Nginx

# 安裝軟件倉(cāng)庫(kù)EPEL,用于yum install xxx提供軟件包
yum install -y epel-release

# 安裝Nginx及依賴(lài)模塊
yum install nginx httpd-tools -y

# 刪除配置
vim /etc/nginx/nginx.conf

# 刪除80端口的server{}配置
image.png
# 創(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

# 檢測(cè)nginx配置文件
nginx -t

# 設(shè)置開(kāi)機(jī)自啟
systemctl enable nginx

# 啟動(dòng)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è)置開(kāi)機(jī)自啟
systemctl enable kibana

# 啟動(dòng)Kibana
systemctl start kibana

# 查看是否啟動(dòng)成功: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è)置開(kāi)機(jī)自啟
systemctl enable logstash

# 啟動(dòng)
systemctl start logstash

# 開(kāi)放防火墻
firewall-cmd --zone=public --add-port=80/tcp --add-port=81/tcp --permanent
firewall-cmd --reload
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀(guān)點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容