https://www.elastic.co/cn/downloads/past-releases?product=elasticsearch
官网选择对应java版本的es
# 解压
tar -xzf elasticsearch-8.18.5-darwin-x86_64.tar.gz
配置环境变量
echo 'export ES_HOME=/usr/local/elasticsearch' >> ~/.zshrc
echo 'export PATH=$ES_HOME/bin:$PATH' >> ~/.zshrc
source ~/.zshrc
启动 ES
# 前台启动
elasticsearch
# 后台启动
elasticsearch -d -p pid
停止 ES
# 前台启动时:Ctrl+C
# 后台启动时:kill $(cat pid)
验证 ES 安装成功
-
访问 ES REST API(8.x 版本默认启用 HTTPS 和身份验证)
# 8.x版本(需使用生成的密码,首次启动时控制台会输出) curl -u elastic:your_password -k https://localhost:9200 # 7.x版本(默认无身份验证) curl http://localhost:9200
成功响应示例
{
"name" : "MacBook-Pro.local",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "xxxxxxxxxxxxxxxxxxxxx",
"version" : {
"number" : "8.18.5",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "xxxxxxxxxxxxxxxxxxxxx",
"build_date" : "2025-08-21T12:22:44.646422286Z",
"build_snapshot" : false,
"lucene_version" : "9.10.0",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
通过官网下载指定kibana版本
https://www.elastic.co/downloads/past-releases?product=kibana
-
解压
tar -xzf kibana-6.8.23-darwin-x86_64.tar.gz cd kibana-6.8.23-darwin-x86_64 -
配置连接 ES 编辑
config/kibana.yml:elasticsearch.hosts: ["http://localhost:9200"] # ES 地址 server.port: 5601 # Kibana 端口 -
启动 Kibana
./bin/kibana