1、centos7 中安装
1.1 直接从官方源安装(不要使用root账号安装)
下载和安装公共签署的key:
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
在 /etc/yum.repos.d/添加 elasticsearch.repo 源
vi /etc/yum.repos.d/elasticsearch.repo
[elasticsearch]
name=Elasticsearch repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
直接安装 Elasticsearch
yum install --enablerepo=elasticsearch elasticsearch
1.2 使用 RPM 安装
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.6.1-x86_64.rpm
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.6.1-x86_64.rpm.sha512
shasum -a 512 -c elasticsearch-8.6.1-x86_64.rpm.sha512
rpm --install elasticsearch-8.6.1-x86_64.rpm
2、windows 中安装
Elasticsearch官网:https://www.elastic.co/cn/products/elasticsearch
官方网站下载链接:https://www.elastic.co/cn/downloads/elasticsearch
请根据自己的需求下载对应的版本。(建议下载Zip包进行安装)
将上一步下载的压缩包解压,下图以Windows为例。

2.1 直接启动使用
执行bin\elasticsearch.bat启动,默认在本机的9200端口启动服务。

使用浏览器访问elasticsearch服务,可以看到类似下面的信息。
2.2 设置服务启动
将elasticsearch设置为windows系统服务:
elasticsearch的bin目录下有一个elasticsearch-service.bat
进入bin目录下执行:
elasticsearch-service.bat install
然后在系统服务中可以看到Elasticsearch已成为系统服务。
elasticsearch-service.bat 的其他命令:
install: 安装Elasticsearch服务
remove: 删除已安装的Elasticsearch服务(如果启动则停止服务)
start: 启动Elasticsearch服务(如果已安装)
stop: 停止服务(如果启动)
manager:启动GUI来管理已安装的服务
作者:admin 创建时间:2023-02-15 16:08
最后编辑:admin 更新时间:2023-09-26 10:12
最后编辑:admin 更新时间:2023-09-26 10:12