ElasticSearch 8 (8.7) 安装教程

Download and install the public signing key:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg

You may need to install the apt-transport-https package on Debian before proceeding:

sudo apt-get install apt-transport-https

Save the repository definition to /etc/apt/sources.list.d/elastic-8.x.list:

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

You can install the Elasticsearch Debian package with:

sudo apt-get update && sudo apt-get install elasticsearch

You can install the Kibana Debian package with:

sudo apt-get update && sudo apt-get install kibana

配置 ElasticSearch

# /etc/elasticsearch/elasticsearch.yml

# 主机 ip + 端口
network.host: 192.168.88.68
http.port: 9200

# 开启 xpack
# Enable security features
xpack.security.enabled: true


# 禁用 https
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: false

生成随机密码

/usr/share/elasticsearch/bin/elasticsearch-reset-password --url http://192.168.88.68:9200 -u elastic

root@elasticsearch:/var/lib/elasticsearch# /usr/share/elasticsearch/bin/elasticsearch-reset-password --url http://192.168.88.68:9200  -u elastic
This tool will reset the password of the [elastic] user to an autogenerated value.
The password will be printed in the console.
Please confirm that you would like to continue [y/N]y


Password for the [elastic] user successfully reset.
New value: HkI1KAdJwi9HxcUMDb

生成 kibana 访问 ES 的密码

/usr/share/elasticsearch/bin/elasticsearch-reset-password --url http://192.168.88.68:9200 -u kibana

root@elasticsearch:/var/lib/elasticsearch# /usr/share/elasticsearch/bin/elasticsearch-reset-password --url http://192.168.88.68:9200  -u kibana
This tool will reset the password of the [kibana] user to an autogenerated value.
The password will be printed in the console.
Please confirm that you would like to continue [y/N]y


Password for the [kibana] user successfully reset.
New value: lgigsc64CJ6+1w+KsW*q

配置 kibana


elasticsearch.username: "kibana"
elasticsearch.password: "lgigsc64CJ6+1w+KsW*q"

# This section was automatically generated during setup.
elasticsearch.hosts: ['http://192.168.88.68:9200']

安装分词器

注意版本一致

/usr/share/elasticsearch/bin/elasticsearch-plugin install https://jansora.oss-cn-shanghai.aliyuncs.com/files/es/8.7.0/elasticsearch-analysis-ik-8.7.0.zip
/usr/share/elasticsearch/bin/elasticsearch-plugin install https://jansora.oss-cn-shanghai.aliyuncs.com/files/es/8.7.0/elasticsearch-analysis-pinyin-8.7.0.zip

重启 ElasticSearch, Kibana

评论栏