Elastic Stack 7.4.0~7.5.0 白金版永不过期

警告:本文章仅限于学习,非商业用途。

  • 目录结构
# 先创建相关目录,具体结构如下:
/opt
|-- bulid # 编译目录
|   |- src
|-- install # 存放tar.gz安装包文件
|-- src # 存放源码文件

mkdir -p /opt/build/src
mkdir -p /opt/install
mkdir -p /opt/src
  • 下载安装包
cd /opt/install
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.0-linux-x86_64.tar.gz
tar zxvf elasticsearch-7.5.0-linux-x86_64.tar.gz
cd .. # 返回到/opt目录
  • 下载源码
cd /opt/src
# 官方github地址:https://github.com/elastic/elasticsearch
# 国内码云地址:https://gitee.com/mirrors/elasticsearch

# 建议使用国内码云地址,选择好跟安装包同版本的tags,然后clone源码
git clone https://gitee.com/mirrors/elasticsearch.git

cd .. # 返回到/opt目录
  • 编译x-pack包
cd /opt/bulid

# lib module
ln -s ../install/elasticsearch-7.5.0/lib .
ln -s ../install/elasticsearch-7.5.0/modules .

# License.java
find ../src -name "License.java" | xargs -r -I {} cp {} .
sed -i 's#this.type = type;#this.type = "platinum";#g' License.java
sed -i 's#validate();#// validate();#g' License.java

# 编译
javac -cp "`ls lib/elasticsearch-7.5.0.jar`:`ls lib/elasticsearch-x-content-7.5.0.jar`:`ls lib/lucene-core-*.jar`:`ls modules/x-pack-core/x-pack-core-7.5.0.jar`" License.java

# x-pack-core-7.5.0.jar
cd /opt/bulid/src
find ../../install -name "x-pack-core-7.5.0.jar" | xargs -r -I {} cp {} .
jar xvf x-pack-core-7.5.0.jar
rm -f x-pack-core-7.5.0.jar
\cp -f ../License*.class org/elasticsearch/license/
jar cvf x-pack-core-7.5.0.jar .

cd .. # 返回到/opt目录
  • 覆盖x-pack-core-7.5.0.jar
# 把编译后的x-pack-core-7.5.0.jar文件覆盖到安装目录下
# 路径根据实际情况而定
cp /opt/build/src/x-pack-core-7.5.0.jar /usr/share/elasticsearch/modules/x-pack-core/
  • 初始化elasticsearch密码
# 前提:elasticsearch是运行状态
# 记住账号和密码,kibana配置需要用

# ./bin/elasticsearch-setup-passwords interactive

Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitorin_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y


Enter password for [elastic]:
Reenter password for [elastic]:
Enter password for [apm_system]:
Reenter password for [apm_system]:
Enter password for [kibana]:
Reenter password for [kibana]:
Enter password for [logstash_system]:
Reenter password for [logstash_system]:
Enter password for [beats_system]:
Reenter password for [beats_system]:
Enter password for [remote_monitoring_user]:
Reenter password for [remote_monitoring_user]:
Changed password for user [apm_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]
  • 配置重启elasticsearch
# 配置
# 这一步主要是操作elasticsearch.yml文件,路径根据实际情况而定

sed -i '$a\xpack.security.enabled: true\nxpack.security.transport.ssl.enabled: true\n' /usr/share/elasticsearch/config/elasticsearch.yml

# 效果
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

# 重启。根据实际情况而定
systemctl restart elasticsearch
  • 配置重启kibana
# 配置
# 这一步主要是操作kibana.yml文件,路径根据实际情况而定
sed -i '$a\elasticsearch.username: kibana\nelasticsearch.password: changeme\n' /usr/share/kibana/config/kibana.yml

# 效果,配置上一步的账号密码
elasticsearch.username: elastic
elasticsearch.password: elastic123

# 重启kibana
systemctl restart kibana
  • 实际效果图

posted @ 2020-04-30 15:55  有安科技  阅读(584)  评论(0编辑  收藏  举报